View attachment 968998sir pahelp namn po ako sa assignment ko nde ko po kasi masundan ehh salamat po
Write a Java program that accepts as input a positive integer value N in the range 1 to 1000, then proceeds to determine and output the factors of N. The program also indicates whether N is a prime number or a composite number. Assume that the input is a valid value in the specified range.
Hindi pa ako marunong ng Java. Guide na lang. C language. Madali lang yan.
#include<stdio.h>
#include<conio.h>
int main(){
int N, ctr, fac = 0;/*N yung number, ctr para sa loop at factors, fac naman para sa number ng factors excluding 1 at yung number itself*/
printf("Input an integer value N from 1 to 1000: ");
scanf("%d", &N);
printf("\nThe factors of %d are:\n1, ", N);
for(ctr = 2; ctr < N; ctr++){
if(N % ctr == 0){
printf("%d, ", ctr);
fac++;
}
}
printf("%d.\n", N);
if(fac == 0)
printf("\n%d is a prime number.", N);
else
printf("\n%d is a composite number.", N);
getch();
}