write the program for prime numbers?
Answer Posted / oza priyanka
#include<stdio.h>
void main()
{
int num,i,cnt;
clrscr();
printf("\n\nEnter the number = ");
scanf("%d",&num);
for(i=2,cnt=0;i<num;i++)
{
if(num%i==0)
cnt=1;
}
if(cnt==0)
printf("\n\nprime number");
else
printf("\n\n not a prime number");
getch();
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What are the types of functions in c?
what is event driven software and what is procedural driven software?
Write a code to remove duplicates in a string.
What is the size of a union variable?
What is the use of ?
Is null always defined as 0(zero)?
Explain how can you be sure that a program follows the ansi c standard?
What are variables c?
What are the advantages of Macro over function?
How does placing some code lines between the comment symbol help in debugging the code?
What is class and object in c?
List the difference between a "copy constructor" and a "assignment operator"?
Where is c used?
Write a program in c to replace any vowel in a string with z?
Do you know the purpose of 'register' keyword?