write the program for prime numbers?
Answer Posted / sachin 12
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i=2,f=0,j;
printf("\n enter any number");
scanf("%d",&num);
a=num;
while(i<num)
{
if(num%i==0)
{
f=1
break;
}
i++;
}
if(f==i)
{
printf("\n the number is not prime");
}
else
{
printf(""\n the number is prime");
}
getch();
}
Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What are the different types of C instructions?
How can you tell whether a program was compiled using c versus c++?
Explain what are compound statements?
What is #pragma statements?
Why is it important to memset a variable, immediately after allocating memory to it ?
What is nested structure in c?
what are bit fields? What is the use of bit fields in a structure declaration?
Why c is called free form language?
What is anagram in c?
What is the use of clrscr?
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
How many loops are there in c?
How does pointer work in c?
How can my program discover the complete pathname to the executable from which it was invoked?
Define Spanning-Tree Protocol (STP)