write the program for prime numbers?

Answer Posted / paps

#include<stdio.h>
void main()
{
int a=1,i,j,b,n;
printf("enter the range\n");
scanf("%d",&n);
printf("prime number series between 1 to %d:n");
printf("%d",a);
while(i<=n)
{
for(j=2;j<i;j++)
{
b=i%j;
if(b==0)
break;
}
if(i==j)
printf("%d",i);
i++;
}
getch();
}

Is This Answer Correct ?    8 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the code in while loop that returns the output of given code?

1315


Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

687


What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

604


How can you return multiple values from a function?

628


write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);

1845






What is a macro, and explain how do you use it?

625


What is array of structure in c programming?

749


Tell us bitwise shift operators?

596


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

605


Explain what will the preprocessor do for a program?

596


What is a null string in c?

586


Explain modulus operator.

595


What is structure pointer in c?

568


How many bytes is a struct in c?

723


Write a program that accept anumber in words

1250