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
What does p mean in physics?
How do you determine whether to use a stream function or a low-level function?
How will you divide two numbers in a MACRO?
1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if
Are pointers integer?
What are the __date__ and __time__ preprocessor commands?
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
Difference between MAC vs. IP Addressing
How to explain the final year project as a fresher please answer with sample project
What is the role of && operator in a program code?
Explain enumerated types in c language?
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)