write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / faizan n
/*A program to print all primes b\w 1-100*/
#include<stdio.h>
#include<conio.h>
void main()
{
int count,i=1;
int a;
int col=0;
clrscr();
for(i=1; i<101; i++)
{
count=0;
a=1;
while(a<=i)
{
if(i%a==0)
count++;
a++;
}
if(count==2)
{
printf("%d\t",i);
col++;
if(col%10==0)
printf("\n");
}
}
getch();
}
| Is This Answer Correct ? | 7 Yes | 5 No |
Post New Answer View All Answers
Are the variables argc and argv are local to main?
What is a macro?
int far *near * p; means
How can I read a binary data file properly?
Are global variables static in c?
Explain about block scope in c?
Explain threaded binary trees?
what is the syallabus of computer science students in group- 1?
How is a null pointer different from a dangling pointer?
what are bit fields in c?
What is build process in c?
What is sizeof in c?
What is the use of a semicolon (;) at the end of every program statement?
Can a variable be both static and volatile in c?
How does sizeof know array size?