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
Explain what is the benefit of using #define to declare a constant?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
Write programs for String Reversal & Palindrome check
What is array in c with example?
What are lookup tables in c?
What do you mean by c what are the main characteristics of c language?
What is the difference between pure virtual function and virtual function?
What is the role of this pointer?
Which header file is essential for using strcmp function?
Which is better oop or procedural?
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
what is use of malloc and calloc?
Can a pointer be static?
What is the difference between a string and an array?