write the program for prime numbers?
Answer Posted / pawan kumar
#include<stdio.h>
int main(){
int num,i,count=0;
printf("Enter a number: ");
scanf("%d",&num);
for(i=2;i<=num/2;i++){
if(num%i==0){
count++;
break;
}
}
if(count==0 && num!= 1)
printf("%d is a prime number",num);
else
printf("%d is not a prime number",num);
return 0;
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Is c# a good language?
in linking some of os executables are linking name some of them
What is meant by initialization and how we initialize a variable?
What are global variables?
what is bit rate & baud rate? plz give wave forms
What is an example of structure?
what is the structure pointer?
write a program to concatenation the string using switch case?
What is the difference between union and anonymous union?
What does 3 mean in texting?
#include
What is the difference between void main and main in c?
Which driver is a pure java driver
In a switch statement, what will happen if a break statement is omitted?
What is sorting in c plus plus?