Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class IfThenElseProject {
- /*
- * I have written a small program to find the largest of three numbers
- * assigned to a, b, and c. Q1. Please draw a flow-chart from the code Q2.
- * Please run it in eclipse and give the result Q3. The program will not
- * give correct result, please draw a corrected flow chart Q4. Please
- * correct the code to give proper output SUBMIT in pencil/paper
- */
- public static void main(String[] args) {
- int a;
- int b;
- int c;
- a = 45;
- b = 90;
- c = 20;
- if (a > b) {
- if (a > c) {
- System.out.println(a + "is the largest");
- } else {
- System.out.println(c + "is the largest");
- }
- } else {
- if (a > c) {
- System.out.println(a + "is the largest");
- } else {
- System.out.println(c + "is the largest");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement