Computer Science, asked by sindujamurugasamy16, 10 months ago

Please fill in the missing lines of code to implement the logic given below.

Logic:

• - Accept a number x as input.

• if x is a prime number, print "prime"

• if x is not a prime number, then print "odd" if x is an odd number - if x is not a prime number, then print "even" if x is an even number

Ambiance

Answers

Answered by babitainsurance
0

Answer:

then all the numbers will be x """ the anser

Explanation:

of this q is

Answered by aadimajestic26
2

Answer:

Hi guys this is the code done with c language, don’t get too puzzled with conditions ,you just have to focus on main “prime numbers” condition.

Explanation:

#include<stdio.h>

void main()

{    

int x;

   scanf("%d",&x);

   int i,flag=0;

   for(i=2;i<=x/2;++i)

{

       if(x%i==0)

//by aaditya

{

           flag=1;

break;

       }

}

   if(flag==0)

{

       printf("prime");

}

   else

{

   if(flag==1 && x%2!=0)

{

           printf("odd");

}

       else

{

           printf("even");

}

   }

}

Similar questions