write the program for prime numbers?
Answer Posted / nitesh sanwal
#include<stdio.h>
#include<math.h>
void main()
{
int n,i,prime=1;
printf("input the numbers");
scanf("%d",&n);
for(i=2;i<=sqrt(n);i++)
if(n%i==0)
{
prime=0;
break;
}
if(prime)
printf("%d is a prime number",n);
else
printf("%d is a not a prime number",n);
}
| Is This Answer Correct ? | 6 Yes | 3 No |
Post New Answer View All Answers
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is the heap in c?
Create a simple code fragment that will swap the values of two variables num1 and num2.
Explain how can type-insensitive macros be created?
Can a pointer be static?
Is c still relevant?
Why do some versions of toupper act strangely if given an upper-case letter?
Can you write the function prototype, definition and mention the other requirements.
What is meant by keywords in c?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
Differentiate between calloc and malloc.
Explain the difference between strcpy() and memcpy() function?
Why is structure important for a child?
Is c pass by value or reference?
Write a program to check prime number in c programming?