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 are pointers? What are stacks and queues?

794


What is signed and unsigned?

837


Explain how can I manipulate strings of multibyte characters?

994


largest Of three Number using without if condition?

1283


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

1928


Can you please explain the difference between malloc() and calloc() function?

877


Can true be a variable name in c?

767


What are the 3 types of structures?

785


Is calloc better than malloc?

793


Explain the difference between structs and unions in c?

779


What is switch in c?

865


How will you delete a node in DLL?

952


What is nested structure?

791


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2097


Do you have any idea about the use of "auto" keyword?

880