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 find whether the given number is prime or
not?

Answer Posted / padhmavathi loganathan

#include<stdio.h>
int main()
{
int a,i,f;
printf("Enter a number: ");
scanf("%d",&a);
f=0;
i=2;
while(i <= a/2)
{
if(a%i == 0)
{
f=1;
break;
}
i++;
}
if(f==0)
printf("Prime Number")
else
printf("Not Prime Number");
return 0;
}

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 break in c?

984


How many levels of pointers can you have?

1134


What is a #include preprocessor?

1073


Can a pointer be static?

1018


What are actual arguments?

1044


Are there constructors in c?

969


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

994


Write a C program to count the number of email on text

1852


explain what are actual arguments?

1028


Explain do array subscripts always start with zero?

1174


what are enumerations in C

1104


which is conditional construct a) if statement b) switch statement c) while/for d) goto

1163


Why is it usually a bad idea to use gets()? Suggest a workaround.

1689


Explain setjmp()?

1007


Explain what are compound statements?

993