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

When should structures be passed by values or by references?

1051


What is static memory allocation? Explain

1107


What are the main characteristics of c language describe the structure of ac program?

1218


How can you find the exact size of a data type in c?

1005


pierrot's divisor program using c or c++ code

2246


Why does this code crash?

1105


Is c is a procedural language?

1102


What are the features of c languages?

1107


What is double pointer?

1008


Can you explain what keyboard debouncing is, and where and why we us it? please give some examples

2205


What is data types?

1096


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

1520


How is a null pointer different from a dangling pointer?

1038


What is variable initialization and why is it important?

1273


Write a program to print "hello world" without using a semicolon?

1071