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
What is ambagious result in C? explain with an example.
What is assert and when would I use it?
Explain what is a const pointer?
Why structure is used in c?
What is switch in c?
Why is c not oop?
How many types of errors are there in c language? Explain
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
What does 3 mean in texting?
Explain what does it mean when a pointer is used in an if statement?
How do you define a function?
I have a varargs function which accepts a float parameter?
Can stdout be forced to print somewhere other than the screen?
What is a stream water?
List the difference between a 'copy constructor' and a 'assignment operator' in C?