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 / shrikanth s.hallikhed

#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==1)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
getch();
}

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me when would you use a pointer to a function?

1124


Why isn't any of this standardized in c? Any real program has to do some of these things.

1266


What does c mean in basketball?

1048


What is the use of getchar() function?

1183


What are the differences between new and malloc in C?

1207


Can we add pointers together?

1116


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

2021


How variables are declared in c?

1105


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

1105


What is the difference between memcpy and memmove?

1086


What is the difference between array and linked list in c?

1207


What are the preprocessor categories?

1115


Can an array be an Ivalue?

1138


What is adt in c programming?

1225


Write a program of advanced Fibonacci series.

1205