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 the program for prime numbers?

Answer Posted / samson mugambi

#include<stdio.h>

int main()
{
int c,i,n;
counter=0;
scanf("%d",&a);
for(i=2;i>a;i++)
if (n%i==0)
{
c=1;break;
}
if(c!=1) ("prime");
else print ("not a prime");
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is scope and lifetime of a variable in c?

1059


What is the maximum length of an identifier?

1184


What are comments and how do you insert it in a C program?

1248


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

2024


What is scope of variable in c?

1043


Why & is used in c?

1186


What is the scope of an external variable in c?

1046


What is the purpose of ftell?

1079


Explain what header files do I need in order to define the standard library functions I use?

1170


Can we replace the struct function in tree syntax with a union?

1308


Write a program to swap two numbers without using third variable?

1293


Explain how can I remove the trailing spaces from a string?

1048


shorting algorithmS

2254


What is identifiers in c with examples?

1176


What is the use of pointers in C?

1077