Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Explain is it valid to address one element beyond the end of an array?

1221


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4695


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

1090


What is the difference between array and structure in c?

1173


find the sum of two matrices and WAP for it.

1143


What happens if you free a pointer twice?

1087


can anyone suggest some site name..where i can get some good data structure puzzles???

2087


How many levels of indirection in pointers can you have in a single declaration?

1093


What is the use of #include in c?

1089


What does s c mean on snapchat?

1116


Explain what is the most efficient way to store flag values?

1232


Can you please explain the difference between syntax vs logical error?

1193


How many types of operator or there in c?

1100


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

2842


What is the purpose of macro in C language?

1127