Math, asked by saimessi13, 9 months ago

write a Java Program to input any set of 10 integer numbers find the sum and the product of the numbers join the sum and the product to form a single number display the cat in nature number​

Answers

Answered by amikkr
24

Program to implement the sum and product of numbers which after evaluation joins both of them and displays the result.

Program:

import java.util.Scanner;

public class Sample

{

public static void main(String[] args) {

 int num[] = new int[10];

 int sum=0,product=1;

 Scanner sc=new Scanner (System.in);

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

 {

     num[i] = sc.nextInt();

     sum = sum + num[i];

     product = product * num[i];

 }

 System.out.println(sum+""+product);

}

}

Answered by ragaharshitha7313
2

Answer:

import.java.util.*;

public class Covert

{

public static void main(String args [ ] )

{

Scanner in = new Scanner ( System .in )

State.out.println( " Enter 10 integers ");

long sum = 0 , prod = 1 ;

for ( int i = 0 , I < 10 , i++ )

{

int n = in.nextInt( );

sum + = n ;

prod * = n ;

}

String s = Long.toString (sum) + Long.toString(prod);

Long r = Long.parselong (s);

System.out.println ("Concatenated Number = " +r);

}

}

HOPE IT HELPS YOU DEAR.....HAVE A GREAT YEAR AHEAD

Similar questions