write the program for prime numbers?
Answer Posted / sikendar kumar
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,count=0;
clrscr();
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");
return 0;
}
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Explain what is the use of a semicolon (;) at the end of every program statement?
What does double pointer mean in c?
What is static and auto variables in c?
What is the use of a static variable in c?
What is break statement?
what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?
What is quick sort in c?
I have a varargs function which accepts a float parameter?
design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.
Explain what is the difference between the expression '++a' and 'a++'?
What is pragma in c?
Why is this loop always executing once?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
Tell me when is a void pointer used?
how to capitalise first letter of each word in a given string?