answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main()

{

int n,a=2;

clrscr();

printf("\n enter n");

scanf("%d",&n);

if(i<=a-1)

{

if(a%i==0)

{

printf("\n the given number is not a Prime number");

break;

}

i++;

if(a==i)

{

printf("\n the given number is a prime number");

}

getch();

output:

enter the value of n:2

the given number is prime number

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program to find whether the given number is prime or not and show output?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


Lab manual in mca 1st sem from ignou?

write a program in C to check whether a given number is apalindrome or not


C program to print inverse of a given number?

Inversing of a given Number. suppose we gave input 123456 then the output of the program will be 654321./*mycfiles.wordpress.comC program to print inverse of a given number*/#include#includevoid main(){long int n,rn=0,d=0;clrscr();printf("Enter the number\n\n");scanf("%ld",&n);while(n>0){d=n%10;rn=rn*10+d;n=n/10;}printf("%ld",rn);getch();}


To check whether the given number is an Avogadro number or not?

45


Write a c program using while loop to accept a number check and display message whether number is perfect or not?

The program is here guys.......... //Finding whether the given number is perfect or not //Starts here #include&lt;stdio.h&gt; void main() { int i=1,temp=0,number; scanf("%d",&amp;number); while(i&lt;=number/2){ if(number%i==0) temp+=i; i++; } if(temp==number) printf("Its a perfect number"); else printf("Its not a perfect number"); } //ends here


How can you tell whether a given number is a multiple of 2?

If it is even


Do an 8086 assembler program to find parity of a given number?

sdfsdfsfsggbcvbg


How do you find equilibrium price when given output and total cost?

The equilibrium price is the unit cost, which is the same as the total cost divided by the number of units produced (output).


Is the set of even counting numbers a well defined or not and why?

Yes it is. Given any number you can decide whether or not it belongs to the set.


Shell program to find the smallest digit of a given number?

syntax error


Program for finding the factorial of the two given number using constructor?

kjhk


Need a'c' program to find given number is even or odd?

No, thanks.