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

Can the size of an array be declared at runtime?

1088


Is c a great language, or what?

1123


What are the advantages of using Unions?

1121


What is the scope of global variable in c?

998


What are type modifiers in c?

1054


struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer

1298


What is the translation phases used in c language?

1124


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

1199


develop algorithms to add polynomials (i) in one variable

2169


What is c mainly used for?

1066


What is a c token and types of c tokens?

1069


What is strcpy() function?

1163


What is a constant?

1063


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1173


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

3322