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
Here is a good puzzle: how do you write a program which produces its own source code as output?
What is null pointer in c?
What is class and object in c?
What is floating point constants?
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
What is meant by operator precedence?
What oops means?
Is that possible to add pointers to each other?
What is define c?
Write a program with dynamically allocation of variable.
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
Difference between Shallow copy and Deep copy?
What are the 5 types of inheritance in c ++?
What is string concatenation in c?
What is #include conio h?