write the program for prime numbers?
Answer Posted / karthik
#include<stdio.h>
#include<conio.h>
void main()
{
int n,flag;
clrscr();
printf("\n Enter prime no\n");
scanf("%d",&n);
for(int i=2;i<=n/2;i++)
{
if(n%i==0)
{
flag=0;
break;
}
}
if(flag==0)
printf("\n%d is not prime",n);
else
printf("\n %d is prime",n);
getch();
}
| Is This Answer Correct ? | 21 Yes | 17 No |
Post New Answer View All Answers
What is console in c language?
Explain why c is faster than c++?
Is null a keyword in c?
What is meant by high-order and low-order bytes?
What is %d called in c?
what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?
Why header file is used in c?
Place the #include statement must be written in the program?
can any one tel me wt is the question pattern for NIC exam
Between macros and functions,which is better to use and why?
Multiply an Integer Number by 2 Without Using Multiplication Operator
Do you know what are the properties of union in c?
What are pointers really good for, anyway?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol