Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Is exit(status) truly equivalent to returning the same status from main?

1007


Can you write the function prototype, definition and mention the other requirements.

1084


What is c preprocessor mean?

1242


Why is this loop always executing once?

998


What is character constants?

1130


What is wrong with this statement? Myname = 'robin';

1263


Explain how can you tell whether a program was compiled using c versus c++?

1053


What is the difference between void main and main in c?

1096


How do I copy files?

1000


Why do we use & in c?

949


What is the hardest programming language?

1098


What is the difference between abs() and fabs() functions?

1059


What is the difference between malloc() and calloc()?

1688


Are there constructors in c?

969


What is c language in simple words?

1012