Write a program for printing prime numbers between 1 and 100.
C Programming Language / Loop control in C Language
1960
If you don't know what is prime number please read form this tutorial. Prime Number & Prime Factors
Program:
#include #include int main() { int i, j,r; for(i = 2; i <= 100; ++i) { r=1; for(j = 2; j <= sqrt(i); ++j) { r=i%j; if(r == 0) break; } if(r!=0) printf("%d\n", i); } getch(); return 0; }
Output:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS