Basic java with output: The sum of all number is = and the product of all number is equals to
import java.util.Scanner;
public class sum_product
{
public static void main (String[]args)
{
int s,o,u,l;
System.out.println ("Enter First Number: ");
Scanner rheyna = new Scanner (System.in);
s = rheyna.nextInt ();
System.out.println ("Enter Second Number: ");
Scanner pallega = new Scanner (System.in);
o = pallega.nextInt ();
u= s+o;
l= s*o;
System.out.println ("The sum of all number is = "+u) ;
System.out.println ("The product of all number is = "+l ) ;
}
}
OUTPUT
Enter First Number: ( example: 5 )
Enter Second Number: ( example: 8 )
The sum of all number is = 13
The product of all number is = 40
HAVE FUN CODING!
“Help us support our site by Donating a small amount of donation"
You can donate by clicking the donate button below.
No comments:
Post a Comment