write the program for prime numbers?
Answer Posted / vijay bharti
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i,count=0;
clrscr();
for(num=1;num<=300;num++)
{
for(i=2;i<=num/2;i++)
{
if(num%i!=0)
count=count+1;
}
}
printf("number of prime numbers between 1 to 300 are : %d",count);
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
How can you call a function, given its name as a string?
What is the use of bitwise operator?
Why do we write return 0 in c?
What is cohesion in c?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
What is the default value of local and global variables in c?
What is #define in c?
What are register variables? What are the advantage of using register variables?
Explain can static variables be declared in a header file?
What is use of integral promotions in c?
Explain what is the benefit of using const for declaring constants?
What is const and volatile in c?
What is the general form of a C program?
What is c standard library?