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


Please Help Members By Posting Answers For Below Questions

What is the use of #define preprocessor in c?

631


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

697


Do array subscripts always start with zero?

800


What does double pointer mean in c?

592


write a program to print largest number of each row of a 2D array

1889






What is array within structure?

601


Are the variables argc and argv are local to main?

805


Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop

1730


What are the string functions? List some string functions available in c.

623


What is the meaning of c in c language?

617


What is the size of a union variable?

612


Explain what is meant by high-order and low-order bytes?

647


What are the advantages of using Unions?

662


Can you please explain the difference between exit() and _exit() function?

612


How do I get a null pointer in my programs?

643