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 / nikhilreddy gujjula

#include<stdio.h>
#include<conio.h>
void main()
{
int prime=1;
int n,i;
printf("enter a number");
scanf("%d",&n);
if(i=2;i<=n/2;i++)
{
if((n%i)==0)
{
prime=0;
break;
}
}
if(prime==1)
{
printf("%d is a prime number",n);
}
else
{
printf("%d is not a prime number",n);
}
getch();
}

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why we use void main in c?

1229


What do you mean by scope of a variable in c?

1055


You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.

2404


What is the sizeof () a pointer?

1045


Explain what is the best way to comment out a section of code that contains comments?

1188


Do you know the difference between malloc() and calloc() function?

1110


How do you determine whether to use a stream function or a low-level function?

1191


How can I find out how much free space is available on disk?

1104


What does *p++ do? What does it point to?

1119


what is use of malloc and calloc?

1950


What is a constant and types of constants in c?

1174


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1421


Why is #define used?

1332


List the different types of c tokens?

1120


What is the difference between test design and test case design?

2130