This program is about checking and print the prime or composite numbers upto given limits using While Loop
#include<stdio.h> int main() { int i,n=2,a,b,prime=0; printf("\nEnter the starting number:"); scanf("%d",&i); printf("\nEnter the ending number:"); scanf("%d",&b); while(i<=b) { prime=0; n=2; while(n<i) { if(i%n==0) { prime++; } n++; } if(prime==0) { printf("\n%d",i); } i++; } return 0; }To download raw file Click Here
Enter the starting number:1 Enter the ending number:15 1 2 3 5 7 11 13
Learn All in Tamil © Designed & Developed By Tutor Joes