write the program for prime numbers?
Answer Posted / shubhanshu pandey
main()
{
int a,c=0,i,n;
printf("enter the number to be checked");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
a=n%i;
if(a=0)
{
c=c+1;
}
}
if (c=2)
{ printf("the given number is prime"); }
else
printf("the given number is not prime");
}
| Is This Answer Correct ? | 7 Yes | 4 No |
Post New Answer View All Answers
Explain modulus operator.
number of times a digit is present in a number
What are register variables in c?
How main function is called in c?
why wipro wase
How is a pointer variable declared?
What is the use of a static variable in c?
What are the various types of control structures in programming?
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
What is the difference between array and pointer?
Can you return null in c?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
How pointers are declared?
List some applications of c programming language?
How can I recover the file name given an open stream or file descriptor?