please give me a c program in which we check wheather a number is prime or nor by using switch...
Answers
Answered by
1
#include
int main()
{
int en_number,flag,I
//en_number= entered number
//Flag= count the number of times
printf("enter the no which has to be checked");
scanf("%d",en_number);
for(i=2;I<=en_number;i++);
{
If(en_number/i==0)
{
flag=1;
}}
switch(flag);
{
case 0: printf("prime");
case 1 : printf("composite");
default : printf(" re enter");
break;
}}
int main()
{
int en_number,flag,I
//en_number= entered number
//Flag= count the number of times
printf("enter the no which has to be checked");
scanf("%d",en_number);
for(i=2;I<=en_number;i++);
{
If(en_number/i==0)
{
flag=1;
}}
switch(flag);
{
case 0: printf("prime");
case 1 : printf("composite");
default : printf(" re enter");
break;
}}
Similar questions
Math,
8 months ago
English,
8 months ago
Math,
8 months ago
Math,
1 year ago
Computer Science,
1 year ago