write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)

Answer Posted / bobby shankar

///Prime Number between 1 to n number
int Prime(int init ,int final)
{
int i;
while(init <= final)
{
i=2;
while(i<init)
{
if(init%i==0)
break;
i++;
}
if(i==init)
printf("\n %d is Prime number",init);
init++;
}
}
int main()
{
int inital,final;
printf("\n Enter your Range followed by space separater
e.g 3 30 : ");
scanf("%d %d",&inital,&final);
Prime(inital,final);
getch();
return 1;
}

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of header files?

621


What is a function simple definition?

648


How can you call a function, given its name as a string?

731


What are high level languages like C and FORTRAN also known as?

705


How are variables declared in c?

613






What are the two types of functions in c?

585


What is the purpose of clrscr () printf () and getch ()?

611


What is volatile variable how do you declare it?

580


Write a code to generate a series where the next element is the sum of last k terms.

755


How do we open a binary file in Read/Write mode in C?

702


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

787


What are the types of type specifiers?

635


while initialization of array why we use a[][2] why not a[2][]...?

1878


What is the difference between fread and fwrite function?

648


What are the modifiers available in c programming language?

755