write the program for prime numbers?

Answer Posted / venkat reddy

#include<stdio.h>
main()
{
int i,n,count=0;
printf("enter a no.");
scanf("%d",&n);
for(i=2;i<n;i++)

{
if(n%i==0)
{
count++;
}
}
if(count>1)
{
printf("not prime no.");

}
else
printf("prime");
}

Is This Answer Correct ?    344 Yes 155 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.

2671


Explain what is the stack?

627


Does sprintf put null character?

587


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2112


What does & mean in scanf?

595






What is line in c preprocessor?

606


Why c is called free form language?

560


How main function is called in c?

620


What is a keyword?

738


Write a program to reverse a given number in c language?

608


What is calloc() function?

614


Why do we use main function?

626


How can I sort a linked list?

628


What is static function in c?

621


What does %d do in c?

535