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
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
Differentiate between new and malloc(), delete and free() ?
Why void main is used in c?
Is null always equal to 0(zero)?
Can you please compare array with pointer?
What is bash c?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
What is #include conio h?
Why is c so powerful?
What is a double c?
What is a node in c?
What is fflush() function?
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
Why is struct padding needed?
What is "Duff's Device"?