#include <stdio.h> int main() { int num1 , num2 , i , c = 0 ; printf("Enter range : "); scanf("%d %d" , &num1 , &num2); printf("Prime numbers in primes.txt file:\n"); while (num1 < num2) { c =0 ; if (num1 <= 1) { ++num1; continue ; } for (i = 2 ; i <= num1/2 ; ++i) { if (num1%i == 0) { c =1 ; break; } } if(c == 0 ) { printf("%d " , num1); } ++num1 ; } printf("\n"); return 0 ; }
Subscribe for more such posts..
Dear Reader...
I hope u are like my posts. If so then please don't forget to like , share and follow my blog for more such posts ,also feel free to write suggestions in the comment box given over here.
Thank you...
I hope u are like my posts. If so then please don't forget to like , share and follow my blog for more such posts ,also feel free to write suggestions in the comment box given over here.
Thank you...
Search This Blog
Print all the prime number, between 1 to 100 in C.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment