Prime

// Find no is prime or not by UDF
#include<stdio.h>
#include<conio.h>
void prime(int);
void main()
{
int a;
clrscr();
printf("\n Enter a number:-");
scanf("%d",&a);
prime(a);
getch();
}
void prime(int k)
{
int m=2;
A:
if(m<k)
{
if(k%m==0)
{
printf("\n No is not prime");
goto B;
}
m++;
goto A;
}
printf("\n No is prime");
B:
}

No comments:

Post a Comment