write a program to print all the prime numbers between 1 and

write a program to print all the prime numbers between 1 and 100.

Solution

#include <stdio.h>
#include <conio.h>
void main()
{
int a[100],i,j=2;
clrscr();
for(i=0;i<100;i++)
   a[i]=i+1;
printf(\"Prime Number between 1 to 100 \ \");
for(i=0;i<100;i++)
   {
    for(j=2;a[i]>j;j++)
      {
     if(a[i]%j==0)
     break;
      }
     if(a[i]==j || a[i]==1)
       printf(\"%d\\t\",a[i]);
    }
getch();
}

write a program to print all the prime numbers between 1 and 100.Solution#include <stdio.h> #include <conio.h> void main() { int a[100],i,j=2; clrsc

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site