write the program for prime numbers?
Answer Posted / d.sukumar
void main()
{
int i,k;int count=0;
int n;
printf("enter a no");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
k=n%i;
if(k==0)
{
count++;
}
}
if(count==1)
printf("prime");
else
printf("not prime");
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
What are the usage of pointer in c?
Did c have any year 2000 problems?
In c language can we compile a program without main() function?
Explain how do you search data in a data file using random access method?
Explain the use of 'auto' keyword
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
Explain the use of 'auto' keyword in c programming?
Does c have function or method?
Is there a way to switch on strings?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
writ a program to compare using strcmp VIVA and viva with its output.
How do you view the path?
Explain the difference between the local variable and global variable in c?
Explain what is a pragma?