Pseudocode:
a := read()
b := read()
c := read()
a := a + 1
c := c - 2
sum := a + b
sub := b - c
mul := a * c
res := (sum + sub + mul) / 3
print(res)
Flowchart:
Code in Java:
import java.util.Scanner;
public class Q240478 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
int c = in.nextInt();
a -= 1;
b += 2;
int sum = a + b;
int sub = b - c;
int mult = a * c;
System.out.println((sum + sub + mult) / 3);
return 0;
}
}
Comments
Leave a comment