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 / paras patel

#include <stdio.h>
#include <conio.h>

int divide(int x ,int y)
{
while(x>y)
{
x-=y;
}

if(x==y)
{
x=0;
}
return x;

}

void main()
{
int c,i,n;
scanf("%d",&n);
clrscr();
for( i=2;i<=n;i++)
{
if(divide(n,i)==0)
{
break;
}

}
if(i!=n)
{
printf("not prime");
}
else
{
printf("prime");
}




getch();
}

Is This Answer Correct ?    16 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is clrscr in c?

1139


What does void main return?

1134


Explain the difference between call by value and call by reference in c language?

1117


Can you please compare array with pointer?

1097


what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555

3075


Is flag a keyword in c?

1161


Is multithreading possible in c?

1023


What is break in c?

1053


How pointers are declared?

966


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

1290


which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;

3269


What is a stream water?

1232


Why is c so popular?

1169


Why does the call char scanf work?

1215


What does %c mean in c?

1106