Computer Science, asked by lucifer8164, 1 year ago

The program must accept an integer N as the input. If the number of digits in N is even then the program must print product of every two digits in N as the output. If the number of the digits in N is odd then the program must print the product of every two digits in N then it must print the remaining digit (last digit) as it is as the output.​
Boundary Conditions: 1<=N<=10^15

Answers

Answered by sailorking
5

Answer:

class solve

{

               public static void main ( int n )

               {

int a = n ;

int count =0;

while ( a ! = 0 )

{

      count + +  ;

       a = a / 10 ;

}

int x =0 ;

if ( count % 2  ! = 0 )

{

           x = n % 10 ;

           n = n / 10;

}

int res = 1 ;

while ( n ! =0 )

{

      res = res * n % 100;

      n = n / 100;

}

res = res * x;

System . out . println ( res );

                }

}

Similar questions