write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / nachiyappan
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,c,n=1;
clrscr();
for(i=1;i<=100;i++)
{
n=n+1;
c=0;
for(j=1;j<=n;j++)
{
if(n%j==0)
c=c+1;
}
if(c==2)
printf("no. %d is prime",n);
else
printf("no. %d is not prime",n);
}
getch();
}
| Is This Answer Correct ? | 33 Yes | 11 No |
Post New Answer View All Answers
What is meant by gets in c?
How many levels deep can include files be nested?
write a program to generate address labels using structures?
Write a program for Overriding.
How can this be legal c?
5 Write an Algorithm to find the maximum and minimum items in a set of ānā element.
What is merge sort in c?
Where static variables are stored in c?
What is actual argument?
using only #include
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
Why void is used in c?
Can we access the array using a pointer in c language?
What is floating point constants?
What is a null string in c?