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 that takes a 3 digit number n and finds out
whether the number 2^n + 1 is prime, or if it is not prime
find out its factors

Answer Posted / nitin garg

#include<stdio.h>
#include<conio.h>
#include<string.h>

int main()
{
int num,i,sum=1,flag=0;
printf("enter three digit no
");
scanf("%d",&num);

for(i=1;i<=num;i++)
{
sum=sum*2;
}
sum++;
printf("
%d",sum);

for(i=2;i<sum/2;i++)
{
if(sum%i==0)
flag=1;
}
if(flag==0)
printf("
number is prime");
printf("

factor is below:
");

for(i=1;i<=sum;i++)
{
if(sum%i==0)
printf("%d ",i);
}

getch();
return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where static variables are stored in memory in c?

948


Can main () be called recursively?

1064


What is wrong with this program statement? void = 10;

1204


What is && in c programming?

1112


What is the difference between exit() and _exit() function in c?

1019


What is indirection? How many levels of pointers can you have?

1090


Can you apply link and association interchangeably?

1071


Who is the main contributor in designing the c language after dennis ritchie?

953


What does c mean in standard form?

1101


What is c programing language?

1043


Which is better malloc or calloc?

1059


praagnovation

2222


What is the difference between printf and scanf in c?

1285


Why shouldn’t I start variable names with underscores?

1007


What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

1064