## บทที่ 7

Smilies

View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review

### Expand view Topic review: บทที่ 7

/* บทที่ 7 ข้อ 5 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void main()
{
unsigned long lnumber;
char string[25];
scanf("%ld",&lnumber);
ultoa(lnumber,string,10);
printf("string = %d unsigned long = %lu\n",strlen(string),lnumber);
strrev(string);
printf("rever = %s \n",string);
}
/* บทที่ 7 ข้อ 1 จ */
#include<stdio.h>
void main()
{
int i=0,j=10,x=0,sume=0;
int num[10];
printf("Enter number \n");
while(i<10)
{
scanf("%d",&num);
++i;
}
while(x<j)
{
if((num[x]%2)!=0)
{
sume+=num[x];
}
++x;
}
printf("\n sum value/2= is %d \t ",sume);
}
/* บทที่ 7 ข้อ 1 ง */
#include<stdio.h>
void main()
{
int i=0,j=10,x=0,sumd=0;
int num[10];
printf("Enter number \n");
while(i<10)
{
scanf("%d",&num);
++i;
}
while(x<j)
{
if(num[x]%2=0)
{
sumd=num[x];
}
++x;
}
printf("\n sum value/2= is %d \t ",sumd);
}
/* บทที่ 7 ข้อ 1 ค */
#include<stdio.h>
void main()
{
int i=0,j=10,x=0 ,sum=0;
int num[10];
printf("Enter number \n");
while(i<10)
{
scanf("%d",&num);
++i;
}
while(x<j)
{
if(num[x]<0)
{
sum+=num[x];
}
++x;
}
printf("\n sum value < 0 is %d \t ",sum);
}
/* บทที่ 7 ข้อ 1 ข */
#include<stdio.h>
void main()
{
int i=0,j=10,x=0;
int num[10];
printf("Enter number \n");
while(i<10)
{
scanf("%d",&num);
++i;
}
printf("\n number add 0 is \t " );
while(x<j)
{
if(num[x]>0)
{
printf(" %d \t ",num[x]);
}
++x;
}

}
/* บทที่ 7 ข้อ 1 ก */
#include<stdio.h>
void main()
{
int i=0,j=10,x=0;
int num[10];
printf("Enter number \n");
while(i<10)
{
scanf("%d",&num);
++i;
}
printf("\n number less 0 is \t " );
while(x<j)
{
if(num[x]<0)
{
printf(" %d \t ",num[x]);
}
++x;
}

}

### บทที่ 7

/* บทที่ 7 ข้อ 3 */
#include<stdio.h>
#include<math.h>
void main()
{
int i,j,k;
long x,t2,t3=1;
k=0;
t2=3;
while(t2<=300)
{
t2+=2;
x=sqrt(t2);
for(i=3;i<=x;i+=2)
if((i=t2%i)==0)
{
break;
}
if(k==0)
{
if(t2-t3<=2)
printf("the twin prine number are %d and %d \n",t2,t3);
t3=t2;
}
}
}