Write a program to print the prime numbers from 1 to 100?
Answer Posted / m santhosh
int count=0;
int number=100; //// print Prime no's from 1 to 100
for(int i=1;i<=number;i++)
{
count=0;
for(int j=1;j<=i;j++)
{
if((i%j==0))
{
count++;
}
}
if(count<=2)
{
printf("\nPrime Number = %d",i);
}
}
| Is This Answer Correct ? | 14 Yes | 9 No |
Post New Answer View All Answers
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
Explain union. What are its advantages?
What are the disadvantages of external storage class?
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
How does free() know explain how much memory to release?
What is a loop?
Why is c so powerful?
What kind of structure is a house?
What is meant by operator precedence?
When was c language developed?
What is the use of #include in c?
What language is lisp written in?
Write a program on swapping (100, 50)
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.