Coding Now – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 9667708830
Home Community WAC to check whether a number is prime or not.

WAC to check whether a number is prime or not.

Soham  •  Jul 17, 2026  •  2 views
0

1 Answers

Soham
Jul 17, 2026
#include <stdio.h>

int main() {
int num, i;
int count = 0;

printf("Enter Number: ");
scanf("%d", &num);

if (num <= 1) {
printf("Number is not prime");
} else {
for (i = 2; i < num; i++) {
if (num % i == 0) {
count++;
}
}

if (count == 0) {
printf("Number is prime");
} else {
printf("Number is composite");
}
}

return 0;
}

Your Answer

Will not be displayed publicly
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →