English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

6 answers

How ever u have not told the format but stilli m writing a program and if there are some syntax errors then u check them out but if there is some logical problems then do lemme know mail me or send me a message i will look into it again. so the program is as follows.



#include

main()
{
int i,j,a=0,b=0,prime[80],noprime[80],flag;
for(i=1;i<=100;i++)
{
for(j=1;j<=i;j++)
{
if(i%j==0)
flag++;
}
if(flag<3)
{
prime[a]=i;
a++;
}
else
{
noprime[b]=i;
b++;
}
flag=0;
}
for(i=0;i<=80;i++)
printf("Prime no. : - %d",prime[i])
for(i=0;i<=80;i++)
printf("Non-Prine no. : - %d",noprime[i])
}

2006-12-03 05:07:14 · answer #1 · answered by Vijay Agarwal 3 · 0 1

If u have any another simple process please send it to me. this is the program.

#include
void main()
{
int i,,j,a[100],b[100],k=0,p=0,flag;
for(i=4;i<=100;i++)
{
for(j=2; j {
if( i%j==0)
{
flag=0;
break;
}
else
flag=1;
}
if(flag==1)
{
a[k]=i;
k++;
}


else
{
b[p]=i;
p++;
}
}

printf("the prime numbers are 1 2 3");
for(i=0;i printf("%d",a[k]);
printf("the non prime numbers are");
for(i=0;i printf("%d",b[p]);
}

2006-12-03 16:44:42 · answer #2 · answered by rose 1 · 0 0

just need to do a for loop, and then nested in the for loop have an if statement that checks if the number is prime or not, and then prints it out if it is.

2006-12-03 05:05:18 · answer #3 · answered by Anonymous · 0 1

#include

main()
{
int i,j,a=0,b=0,prime[80],noprime[...
for(i=1;i<=100;i++)
{
for(j=1;j<=i;j++)
{
if(i%j==0)
flag++;
}
if(flag<3)
{
prime[a]=i;
a++;
}
else
{
noprime[b]=i;
b++;
}
flag=0;
}
for(i=0;i<=80;i++)
printf("Prime no. : - %d",prime[i])
for(i=0;i<=80;i++)
printf("Non-Prine no. : - %d",noprime[i])
}

2006-12-04 03:58:20 · answer #4 · answered by lalit s 1 · 0 0

please,just google that.Its there on the web

2006-12-03 04:42:42 · answer #5 · answered by emeka_micro 1 · 0 1

do your own home work

2006-12-03 04:36:57 · answer #6 · answered by Steve 4 · 0 1

fedest.com, questions and answers