write the program for prime numbers?
Answer Posted / pran pratim
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num,i,count=0;
cout<<"Enter the number::";
cin>>num;
for(i=2;i<=num/2;i++)
{
if(num%i==0)
{
count++;
break;
}
}
if(count==0)
{
cout<<"The number is Prime";
}
else
cout<<"The number is Composite";
getch();
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is hashing in c language?
What does stand for?
What are the disadvantages of c language?
What are data structures in c and how to use them?
what is the role you expect in software industry?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
Explain what is the benefit of using enum to declare a constant?
Write a program to reverse a given number in c?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
Why isn't any of this standardized in c? Any real program has to do some of these things.
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
What is double pointer in c?
Write a program on swapping (100, 50)
What is the use of a semicolon (;) at the end of every program statement?
What are the difference between a free-standing and a hosted environment?