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

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

4355


How do you redirect a standard stream?

1154


What is function what are the types of function?

1058


What is a loop?

1113


What is the use of a ‘’ character?

1150


Explain how can you tell whether two strings are the same?

1079


Write a program to generate the Fibinocci Series

1305


Write the control statements in C language

1283


main() { printf("hello"); fork(); }

1251


What is extern variable in c with example?

1056


How to set file pointer to beginning c?

1249


What is meant by high-order and low-order bytes?

1106


What does it mean when a pointer is used in an if statement?

1157


What are the features of c language?

1127


What is the size of empty structure in c?

1128