C Tutorial
This c program is used to find the composite numbers upto the user input limit.
A number greater than 1 which are not a prime number.
#include<stdio.h> void main() { int i, j, limit; int composite = 0; printf("Enter limit: "); scanf("%d", &limit); printf("Composite Numbers upto (%d): ", limit); for(i = 2;i <= limit;i++) { composite = 0; for(j = i-1; j > 1 ; j--) { if(i%j == 0) composite = 1; } if(composite == 1) printf("%d\t", i); } printf("\n"); }Output:
$ cc composite-numbers-list.c $ ./a.out Enter limit: 100 Composite Numbers upto (100): 4 6 8 9 10 12 14 15 16 18 20 21 22 24 25 26 27 28 30 32 33 34 35 36 38 39 40 42 44 45 46 48 49 50 51 52 54 55 56 57 58 60 62 63 64 65 66 68 69 70 7274 75 76 77 78 80 81 82 84 85 86 87 88 90 91 92 93 94 95 96 98 99 100
C Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page