Write a program to find and display the Composite Numbers in the range [1 - 100]. For each Composite Number found, display the factors of that particular number. (There should be 74 composite numbers in the given range) OUTPUT : 4 is a composite number. The factors of 4 are : 1 2 4 6 is a composite number: The factors of 6 are : 1 2 3 6 (and so on...)
its for cls 9
Answers
Answered by
0
Answer:
// composite number
#include<stdio.h>
int main()
{
int i,n,factor;
printf("Enter the number:");
scanf("%d",&n);
for(i=1;i<n;i++)
{
if(n%i==0)
{
factor=i;
}
}
if(factor>1)
{
printf ("The number is a composite number!");
}
else
{
printf ("This is not a composite number!");
}
return 0;
}
Similar questions