write the program for prime numbers?

Answer Posted / pritam neogi

#include<stdio.h>
#include<conio.h>
void main()
{
int no,i;
clrscr();
printf(" Enter the Number U want to check:");
scanf("%d",&no);
i=2;
while(i<=no-1)
{
if(no%i==0)
{
printf(" %d is not Prime number",no );
// break;
}
i=i+1;
}
if(no==i)
printf("%d is a prime Number",no);
getch();
}

Is This Answer Correct ?    24 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

909


What is the use of a semicolon (;) at the end of every program statement?

1179


What is the difference between the = symbol and == symbol?

859


Explain what standard functions are available to manipulate strings?

855


What is c preprocessor mean?

1064


Write the control statements in C language

905


What is meant by 'bit masking'?

1153


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

858


Do character constants represent numerical values?

1104


What is a constant?

841


What does main () mean in c?

891


What is multidimensional arrays

890


What is a pointer value and address in c?

856


Why do we need volatile in c?

973


Explain high-order bytes.

915