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

1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if

3987


What is wrong with this declaration?

619


How many levels of pointers can you have?

715


Can we access the array using a pointer in c language?

567


When is a “switch” statement preferable over an “if” statement?

657






What is the purpose of main() function?

669


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

661


What does malloc () calloc () realloc () free () do?

570


cavium networks written test pattern ..

3602


Is null equal to 0 in sql?

661


Explain what is #line used for?

615


the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function

771


What does 2n 4c mean?

738


What is #line?

621


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

741