write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / shailesh singh
#include<stdio.h>
#include<conio.h>
void main()
{
int flag,x;
clrscr();
printf("2\t");
for(int i=3;i<=100;i++)
{
flag=0;
for(x=2;x<=i;x++)
{
if(i%x==0)
{
flag=1;
break;
}
else
continue;
}
if(i==x)
printf("%d\t",i);
}
getch();
}
Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What is the use of #define preprocessor in c?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
Do array subscripts always start with zero?
What does double pointer mean in c?
write a program to print largest number of each row of a 2D array
What is array within structure?
Are the variables argc and argv are local to main?
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
What are the string functions? List some string functions available in c.
What is the meaning of c in c language?
What is the size of a union variable?
Explain what is meant by high-order and low-order bytes?
What are the advantages of using Unions?
Can you please explain the difference between exit() and _exit() function?
How do I get a null pointer in my programs?