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
What does the c in ctime mean?
How many levels of pointers can you have?
Stimulate calculator using Switch-case-default statement for two numbers
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
How can I direct output to the printer?
How pointer is different from array?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
What are the 5 elements of structure?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
What are the advantages and disadvantages of c language?
Define the scope of static variables.
When should we use pointers in a c program?
How can I trap or ignore keyboard interrupts like control-c?
what is stack , heap ,code segment,and data segment
What is quick sort in c?