Basic Programs
If Else based Programs
Loop Based Programs
Array Based Programs
String Programs
Function Programs
Pointers Programs
Structure & File Handling Programs
Data Structure Programs
Loop based Programs
C Program to check given number is prime or not
#include <stdio.h>
#include <conio.h>
void main()
{
int n=0, i=2, flag=0;
printf("enter the no");
scanf("%d",&n);
while(i<n)
{
if(n%i==0)
{
flag=1;
break;
}
i++;
}
if(flag==0)
printf("the given number is prime no");
else
printf("the given number is not prime no");
} Output of the above program is as following.
Video/ C Introduction
Watch video in full size

Enquiry about Course