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


Please Help Members By Posting Answers For Below Questions

What does d mean?

581


what is recursion in C

614


we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?

804


Explain what are binary trees?

611


Are the outer parentheses in return statements really optional?

575






Explain can static variables be declared in a header file?

678


What is meant by high-order and low-order bytes?

654


What would be an example of a structure analogous to structure c?

574


What is line in c preprocessor?

614


What are the uses of a pointer?

681


What is LINKED LIST? How can you access the last element in a linked list?

633


#include int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20

1262


How can you be sure that a program follows the ANSI C standard?

1127


What is variable in c example?

592


What are the 4 data types?

594