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
What is the code in while loop that returns the output of given code?
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)
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?
How can you return multiple values from a function?
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 []);
What is a macro, and explain how do you use it?
What is array of structure in c programming?
Tell us bitwise shift operators?
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
Explain what will the preprocessor do for a program?
What is a null string in c?
Explain modulus operator.
What is structure pointer in c?
How many bytes is a struct in c?
Write a program that accept anumber in words