write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)

Answer Posted / nikhil

#include<stdio.h>
#include<conio.h>
void main()
{
int m,flag;
flag=0;
for(int i=2;i<100;i++)
{
for(int j=1;j<i;j++)
{
if(i%j==0)
{flag++;
}
}
if(flag==2)
{printf("it is prime %d",i);
}

}
getch();
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a nested formula?

616


List some of the static data structures in C?

768


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1474


What is a MAC Address?

637


What is the use of the function in c?

612






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

689


What are the advantages of using linked list for tree construction?

658


write a proram to reverse the string using switch case?

2478


Why c is a mother language?

563


What is wrong with this declaration?

619


Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.

1779


What is the best style for code layout in c?

639


How can I invoke another program or command and trap its output?

628


Why is %d used in c?

575


Using which language Test cases are added in .ptu file of RTRT unit testing???

3612