Header Ads Widget

Ticker

6/recent/ticker-posts

implement the c program to dispaly the even and odd number in given 2d array

 COMPUTER GAYN

Q.  implement the c program to dispaly the even and odd number          in   given 2d array

ANS:-          #include<stdio.h>

                       int main()

                   {

                 int a[3][3],i,j;

                 printf("enter the 2d array elment:\n");

                 for(i=0;i<=2;i++)

                 {

           for(j=0;j<=2;j++)

             {

           scanf("%d",&a[i][j]);

             }

                }

               printf("even the numbers of 2D array \n");

               for(i=0;i<=2;i++)

             {

      for(j=0;j<=2;j++)

       {

   if((a[i][j]%2)==0);

    {

printf("%d",a[i][j]);

   }

      }

   }

          printf("odd numbers of 2d array \n");

          for(i=0;i<=0;i++)

           {

       for(j=0;j<=2;j++)

        {

     if((a[i][j]%2)!=0)

   {

printf("%d",a[i][j]);

   }

       }

  }

return 0;


                      }

Post a Comment

0 Comments