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...

how to find the given number is prime or not?

Answer Posted / rajamanickam.m

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,flag=0,ctr;
printf("enter the number to be checked\n");
scanf("%d",&n);
for(ctr=2;ctr<=sqrt(n);ctr++)
{
if(n%ctr==0)
{
flag=1;
break;
}
}
if(flag==0)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
getch();
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you view the path?

1126


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

1137


What are loops c?

1056


How is a macro different from a function?

1186


Where static variables are stored in memory in c?

1003


How can I remove the trailing spaces from a string?

1077


What are enumerated types?

1194


What are the advantages of using macro in c language?

1130


If the size of int data type is two bytes, what is the range of signed int data type?

1026


Is it valid to address one element beyond the end of an array?

1175


What is methods in c?

1100


Describe static function with its usage?

1210


What are the different properties of variable number of arguments?

1164


What's the right way to use errno?

1149


What are file streams?

1020