Print the largest even and odd number from the list in c Language

Program for printing the largest even and odd number from the list

#include<stdio.h>
#include<conio.h>
void main()
{
   int i, num, even=0, odd=0;
   clrscr();
   printf("\nEnter any ten numbers: ");
   for(i=0;i<10;i++)
   {
      scanf("%d",&num);
      if (num%2 == 0 && num>even)
         even = num;
      if( num%2 != 0 && num> odd)
         odd = num;
   }
   printf("\n Largest even number is = %d",even);
   printf("\n Largest odd number is = %d", odd);
   getch();
}

kabeer

Added  Jul 24, 01:42 am

Article tags

×
Google login
SignUp with Email
X