C Program to Check if the Number is a prime

This Program asks the user to enter any number and it checks wither this number is prime or not. Code [v1] #include "stdio.h" #include "conio.h" void main() { int num,prime = 1,i; printf("Enter a number: "); scanf("%d", &num); for(i=2; i<num; i++) { if(num%i == 0) { prime = 0; break; } } if(prime) printf("The Number [...]
11:57 AM | Posted in C Examples | Read More »









Recent Comments