Advertisement
ruhul0

IfThenElseProject

Mar 8th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1.  
  2. public class IfThenElseProject {
  3.  
  4.     /*
  5.      * I have written a small program to find the largest of three numbers
  6.      * assigned to a, b, and c. Q1. Please draw a flow-chart from the code Q2.
  7.      * Please run it in eclipse and give the result Q3. The program will not
  8.      * give correct result, please draw a corrected flow chart Q4. Please
  9.      * correct the code to give proper output SUBMIT in pencil/paper
  10.      */
  11.     public static void main(String[] args) {
  12.         int a;
  13.         int b;
  14.         int c;
  15.  
  16.         a = 45;
  17.         b = 90;
  18.         c = 20;
  19.  
  20.         if (a > b) {
  21.             if (a > c) {
  22.                 System.out.println(a + "is the largest");
  23.             } else {
  24.                 System.out.println(c + "is the largest");
  25.             }
  26.         } else {
  27.             if (a > c) {
  28.                 System.out.println(a + "is the largest");
  29.             } else {
  30.                 System.out.println(c + "is the largest");
  31.             }
  32.         }
  33.     }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement