Hi!.This is my basic program to display Prime no's from 2 to 100.
I tried for weeks to get the algorithm correct. Still the code does have some problems. It prints all the numbers from 2 to 200.
Glad if someone cud help to solve my problem.
*************************code********************* ******************
[code tags added by ygfperson]Code:/* All prime numbers between 2 to 100 */ #include<stdio.h> void main() { int num,i=2,rem; for(num=2;num<100;num++) { while(i<num) { rem=num%i; i++; if(rem!=0) break; } if(rem!=0) printf("%d\t",num); } } *********************************************************************
Thanks
Mur![]()



LinkBack URL
About LinkBacks



