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 / nitesh sanwal

#include<stdio.h>
#include<math.h>
void main()
{
int n,i,prime=1;
printf("input the numbers");
scanf("%d",&n);
for(i=2;i<=sqrt(n);i++)
if(n%i==0)
{
prime=0;
break;
}
if(prime)
printf("%d is a prime number",n);
else
printf("%d is a not a prime number",n);
}

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to print the character with maximum occurence and print that number of occurence too in a string given ?

2477


What is the heap in c?

1085


Create a simple code fragment that will swap the values of two variables num1 and num2.

1291


Explain how can type-insensitive macros be created?

999


Can a pointer be static?

1090


Is c still relevant?

1088


Why do some versions of toupper act strangely if given an upper-case letter?

1078


Can you write the function prototype, definition and mention the other requirements.

1140


What is meant by keywords in c?

1073


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

1249


Differentiate between calloc and malloc.

1275


Explain the difference between strcpy() and memcpy() function?

1016


Why is structure important for a child?

1105


Is c pass by value or reference?

1042


Write a program to check prime number in c programming?

1099