write the program for prime numbers?
Answer Posted / nandhini
#include<stdio.h>
int main()
{
int i,j,n,count=0;
printf("Enter the number:");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
for(j=2;j<=i;j++)
{
if(i%j==0 && i/1==i)
{
count=count+1;
}
}
if(count==1)
{
printf("\n%d",i);
}
count=0;
}
}
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
How can I access an I o board directly?
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
What functions are used in dynamic memory allocation in c?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
difference between Low, Middle, High Level languages in c ?
Using which language Test cases are added in .ptu file of RTRT unit testing???
write a program to create a sparse matrix using dynamic memory allocation.
What is the difference between union and structure in c?
Explain what are global variables and explain how do you declare them?
How can I do peek and poke in c?
Explain how do you determine a file’s attributes?
Explain the advantages of using macro in c language?
What is a class c rental property?
What does %2f mean in c?