write the program for prime numbers?

Answer Posted / noble

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter any number:");
scanf("%d",&a);
for(b=2;b<=a-1;b++)
{
if(a%b==0)
break;
}
if(a==b)
{
printf("%d is prime number",a);
}
else
{
printf("%d is not prime number",a);
}
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are actual arguments?

654


Which is an example of a structural homology?

802


Is a house a mass structure?

650


Is fortran faster than c?

589


How to write a code for reverse of string without using string functions?

1585






Why shouldn’t I start variable names with underscores?

633


hi send me sample aptitude papers of cts?

1663


How do you construct an increment statement or decrement statement in C?

753


a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if

712


Write a program to reverse a given number in c?

605


What is call by reference in functions?

579


What is infinite loop?

635


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2034


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

15527


When c language was developed?

646