write the program for prime numbers?
Answer Posted / pritam neogi
#include<stdio.h>
#include<conio.h>
void main()
{
int no,i,count=0;
clrscr();
printf("enter the no");
scanf("%d",&no);
for(i=1;i<=no;i++)
{
if(no%i==0)
{
count=count+1;
}
}
if(count<=2)
{
printf("this is prime no");
}
else
{
printf("this is not prime");
}
getch();
}
| Is This Answer Correct ? | 32 Yes | 16 No |
Post New Answer View All Answers
What is the best way to store flag values in a program?
Explain how can I right-justify a string?
How can I write a function that takes a format string and a variable number of arguments?
Write a code on reverse string and its complexity.
What is function definition in c?
What is the use of a ‘ ’ character?
What is static and volatile in c?
What is meant by initialization and how we initialize a variable?
How can you allocate arrays or structures bigger than 64K?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
When should a type cast be used?
What are the different types of pointers used in c language?
Write a program to swap two numbers without using the third variable?
write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.
What is 1f in c?