write the program for prime numbers?
Answer Posted / pratibha
#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 ? | 17 Yes | 14 No |
Post New Answer View All Answers
Explain the advantages and disadvantages of macros.
What is the difference between functions abs() and fabs()?
What is the difference between Printf(..) and sprint(...) ?
What does %p mean?
What are 3 types of structures?
Why enum is used in c?
What is the difference between #include
Explain how can I convert a number to a string?
Is c language still used?
Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff
Write programs for String Reversal & Palindrome check
What does the function toupper() do?
What are the Advantages of using macro
What is string concatenation in c?
What is the general form of a C program?