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


Please Help Members By Posting Answers For Below Questions

What are the types of pointers?

594


What are the advantage of c language?

542


Is fortran still used in 2018?

582


What is difference between class and structure?

562


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

646






Is return a keyword in c?

590


What is structure in c explain with example?

623


what is bit rate & baud rate? plz give wave forms

1508


Why do we need arrays in c?

571


write a program to concatenation the string using switch case?

1550


What is c definition?

735


write a program for the normal snake games find in most of the mobiles.

1776


What is the difference between local variable and global variable in c?

677


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1499


stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

1839