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


Please Help Members By Posting Answers For Below Questions

Explain the advantages and disadvantages of macros.

630


What is the difference between functions abs() and fabs()?

651


What is the difference between Printf(..) and sprint(...) ?

792


What does %p mean?

598


What are 3 types of structures?

596






Why enum is used in c?

528


What is the difference between #include

and #include “header file”?

555


Explain how can I convert a number to a string?

652


Is c language still used?

540


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

2244


Write programs for String Reversal & Palindrome check

601


What does the function toupper() do?

661


What are the Advantages of using macro

688


What is string concatenation in c?

570


What is the general form of a C program?

600