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();
printf(" no. 1 is neither a prime nor composite no.");
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("\n no. %d is prime",n);
else
printf("\n no. %d is not prime",n);
}
getch();
}
| Is This Answer Correct ? | 26 Yes | 8 No |
Post New Answer View All Answers
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
how many key words availabel in c a) 28 b) 31 c) 32
Explain how can I prevent another program from modifying part of a file that I am modifying?
Can a pointer be static?
Not all reserved words are written in lowercase. TRUE or FALSE?
What is the use of printf() and scanf() functions?
What is s or c?
Explain Basic concepts of C language?
What are enums in c?
What are the types of type specifiers?
What are the advantages and disadvantages of pointers?
What is the difference between c &c++?
When c language was developed?
What is the difference between mpi and openmp?
What are the different types of objects used in c?