Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Download - Green Lantern 2011
Arithmetic (Input/Output) EmptySun Sep 25, 2011 4:47 pm by Admin

» Download - Shark Night 3D
Arithmetic (Input/Output) EmptySun Sep 25, 2011 4:41 pm by Admin

» Download - Apollo 18
Arithmetic (Input/Output) EmptyWed Sep 21, 2011 6:37 am by Admin

» [REMODELLED] PSP E1000 - REVAMPED
Arithmetic (Input/Output) EmptyMon Sep 19, 2011 9:56 am by Admin

» PS VITA IS OFFICIALLY REGION FREE!!
Arithmetic (Input/Output) EmptyMon Sep 19, 2011 9:49 am by Admin

» Manga - Popcorn Avatar
Arithmetic (Input/Output) EmptyMon Sep 19, 2011 9:11 am by Admin

» [UPCOMING SOON] Assassin's Creed - Revelations
Arithmetic (Input/Output) EmptyMon Sep 19, 2011 8:44 am by Admin

» Assassin's Creed 2
Arithmetic (Input/Output) EmptyMon Sep 19, 2011 8:26 am by Admin

» Assassin's Creed
Arithmetic (Input/Output) EmptyMon Sep 19, 2011 6:47 am by Admin

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

Admin

Admin
Investor Persona
File name: arithmetic2.java

Code:


import java.io.*;
public class arithmetic2{
          public static void main(String[] args)throws IOException{
          BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

          double ave, quot, num1, num2, sum, diff, prod, mod;

          System.out.println("Enter Number for Data1");
          num1 = Integer.parseInt(input.readLine());
          System.out.println("Enter Number for Data2");
          num2 = Integer.parseInt(input.readLine());

          sum = num1+num2;
          diff = num1-num2;
          prod = num1*num2;
          quot = num1/num2;
          mod = num1%num2;
          ave = sum/2;

          System.out.println("  ");
          System.out.println("Sum: "+sum);
          System.out.println("Difference: "+diff);
          System.out.println("Product: "+prod);
          System.out.println("Quotient: "+quot);
          System.out.println("Modulo: "+mod);
          System.out.println("Average: "+ave);
          }
}

Display Results:

Enter Number for Data1:
x
Enter Number for Data2:
x

Sum: xx.xx
Difference: xx.xx
Product: xx.xx
Quotient: xx.xx
Modulo: xx.xx
Average: xx.xx

https://advatar.forumotion.com
Share this post on: reddit

No Comment.

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum

 

Free forum | ©phpBB | Free forum support | Report an abuse | Forumotion.com