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 meant by inheritance?
What is use of bit field?
What is the scope of global variable in c?
Why ca not I do something like this?
What is a struct c#?
What is difference between class and structure?
How can I implement a delay, or time a users response, with sub-second resolution?
Describe the difference between = and == symbols in c programming?
What is void main ()?
What are global variables?
What are the differences between new and malloc in C?
What is the use of sizeof?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
What is a pointer value and address in c?