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

What does *p++ do?

978


Why is event driven programming or procedural programming, better within specific scenario?

2365


What are header files in c?

1020


how to find binary of number?

4336


Difference between Shallow copy and Deep copy?

1968


PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM

2144


What is typedef struct in c?

999


What is the use of a semicolon (;) at the end of every program statement?

1411


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

1236


What is meant by keywords in c?

1036


What is difference between constant pointer and constant variable?

1204


What is the use of ?: Operator?

1079


a value that does not change during program execution a) variabe b) argument c) parameter d) none

1181


How can I copy just a portion of a string?

1271


Using which language Test cases are added in .ptu file of RTRT unit testing???

4217