Saturday, 19 November 2022

Selection Control Structure - Assignment 1

 

Selection Control Structure - Assignment 1

Problem Statement

Implement a program to display the sum of two given numbers if the numbers are same. If the numbers are not same, display the double  of the sum.

 

Sample Input and Output


class Tester{
public static void main(String[]args){
int a=5,b=5;
int sum=0;
if(a==b)
{sum=a+b;
}
else{
sum=2*(a+b);
}
System.out.println(sum);
}
}


Implement a program to display the sum of two given numbers if the numbers are same. If the numbers are not same, display the double of the sum.     Sample Input and Output








No comments:

Post a Comment

Free Resume Template

Creating a blog post that discusses the pros and cons of using a resume rule is a great way to provide valuable information to job seekers ...