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 I ++ in c programming?

1113


What is derived datatype in c?

1090


What is the purpose of the preprocessor directive error?

1267


Why doesnt long int work?

1035


What does int main () mean?

1021


When is a null pointer used?

1108


How can I get random integers in a certain range?

1063


which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +

1734


What is the difference between volatile and const volatile?

983


What is the Purpose of 'extern' keyword in a function declaration?

1077


Explain how do you search data in a data file using random access method?

1132


Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

1100


Is boolean a datatype in c?

1064


Explain a file operation in C with an example.

1119


How many types of arrays are there in c?

1042