write the program for prime numbers?
Answer Posted / sachin 12
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i=2,f=0,j;
printf("\n enter any number");
scanf("%d",&num);
a=num;
while(i<num)
{
if(num%i==0)
{
f=1
break;
}
i++;
}
if(f==i)
{
printf("\n the number is not prime");
}
else
{
printf(""\n the number is prime");
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What are the types of type specifiers?
What is define c?
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
What is local and global variable in c?
What are the types of pointers in c?
Differentiate between declaring a variable and defining a variable?
Explain what are reserved words?
Explain what is the difference between far and near ?
What tq means in chat?
Why is %d used 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
What is string constants?
What is difference between union All statement and Union?
Explain what happens if you free a pointer twice?
What is the benefit of using an enum rather than a #define constant?