write the program for prime numbers?

Answer Posted / sudesh kumar

#include<iostream.h>
#include<conio.h>
void main()
{
int no;
cout<<"enter a no";
cin>>no;
for(i=2;i<no;i++)
{
r=no%i;
if(r==0)
{
p==0;
break;
}}
if(p==1)
{
cout<<"prime no";
}
else
{
cout<<"note prime";
}
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How are structure passing and returning implemented?

593


What are the 5 types of organizational structures?

551


What is the difference between test design and test case design?

1571


What type is sizeof?

587


Explain what is the benefit of using const for declaring constants?

617






What are data types in c language?

587


Explain the difference between the local variable and global variable in c?

605


What is sizeof return in c?

618


Can you explain what keyboard debouncing is, and where and why we us it? please give some examples

1663


What is difference between structure and union in c?

549


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

2986


What is a const pointer?

639


What is the use of void pointer and null pointer in c language?

632


Why we use stdio h in c?

585


what are non standard function in c

1438