| Close | Back |
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,j = 1;
char response[4];
clrscr();
printf("\nThis program will tell weather a number is prime or not");
printf("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
do
{
do
{
printf("\nEnter a positive integer:");
scanf("%d",&n);
}
while(n <= 0);
if(n == 1)
printf("\n%d isn\'t a prime number",n);
else
{
for(i = 2;i < (n/2);i++)
{
if(n%i == 0)
{
j = 0;
break;
}
}
if(j)
printf("\n%d is prime",n);
else
printf("\n%d isn\'t prime",n);
}
printf("\nAnother time (y/n):");
scanf("%3s",response);
}
while(response[0] == 'y' || response[0] == 'Y');
printf("\Hit any key to continue...");
getch();
print_rajesh();
return(0);
}
/*************************************************************************************/
/* A C Function to print rajesh in a stylish way can (should) be used in any cprogram*/
/*************************************************************************************/
print_rajesh()
{
clrscr();
printf("\nThis program made by :");
printf("\n\n\n\n\n\007");
printf(",##########. ,####. ,####.\n");
printf(":#############. `####; :####.\n");
printf(":#####. :#####. :####.\n");
printf(":#############; `#########. ,####. ,#######. ,########. :###########.\n");
printf(":############; :####. :####. ,###. :###. ,####. :#. :###########.\n");
printf(":##########. :#########. :####.,####. :####.`##########. :####. :####.\n");
printf(":###########. ,############. :####.:###########; `#########.:####. :####.\n");
printf(":############. :#####. :####. :####.`#####. :#####;:####. :####.\n");
printf(":#####. `###### ############. :####. `#########. ,#########; :####. :####.\n");
printf("`#####; `######; `##########; :####. `#####; `#######; `####; `####;\n");
printf(" #####");
printf("\n\n\n\tRajesh _ThE gReAt in 2k.....\n\n\n\t\t\tHit any key to continue.....");
getch();
}