I'm newly new to C programming , started about a week ago ! And i'm getting into loops i faced a problem writing a C program to show prime numbers less-than 100 . I'll share up the C code i've written and its output ! I'll wait for your help and your remarks about it
#include<stdio.h>
main(){
int i,d,k;
for( i=1 ; i<=100 ; i++ ){
d=0;
for( k=1 ; k<=i ; k++ ){
if( i%k==0){
d=d+1;
}
}
if( d==1 ){
printf("\n%d",i);
}
}
getchar();
getchar();
}
Output:
1
Thanx !