write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)

Answer Posted / anshul

#include <stdio.h>
#include<conio.h>

void main()
{
int i,j,k;
for (i=1;i<=100;i++)
{
k=0;
for (j=1;j<i;j++)
{
if (i%j==0)
{
k++;
}
}
if(k==2)
{
printf("%d \n",i);
}
}
getch();
}
It displays all prime no. from 1 to 100
commants: er.anshul2009@gmail.com

Is This Answer Correct ?    4 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is assignment operator?

630


Does c have class?

615


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

2940


What is the difference between formatted&unformatted i/o functions?

620


What are the preprocessor categories?

641






Explain how can type-insensitive macros be created?

573


What is sizeof int in c?

606


What are qualifiers and modifiers c?

551


What is the difference between text and binary i/o?

595


write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.

1580


What are comments and how do you insert it in a C program?

746


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1675


What is the difference between functions getch() and getche()?

625


Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.

665


What is memory leak in c?

639