public class Main {
public static void main(String[] args) {
int a = 2;
int b = 3;
int c = 5;
int perimeterOfATriangle = a + b + c;
System.out.println("The perimeter of the triangle is : " + perimeterOfATriangle);
}
}
NOTE:
- Didn't need Scanner as it was not needed to take input from the user.
- Used int as there was no decimal in the value.
- We all know that perimeter of a triangle is calculated by adding all three sides which I supposed a , b and c in above program.
No comments:
Post a Comment