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 difference between arrays and pointers?

1032


What is the use of #include in c?

1047


How can I make sure that my program is the only one accessing a file?

1215


Why c is called procedure oriented language?

1011


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

2021


How can I remove the leading spaces from a string?

1116


what are the facialities provided by you after the selection of the student.

2197


Why we not create function inside function.

2154


What is the purpose of main( ) in c language?

1112


What does the message "automatic aggregate intialization is an ansi feature" mean?

1153


What is static memory allocation? Explain

1057


What are header files in c?

1045


Write a program to reverse a string.

1043


What does it mean when a pointer is used in an if statement?

1074


What is structure in c explain with example?

1118