Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project: Exam_101_January_2016 - created by borkins on 2017-05-03.
- */
- import java.util.Scanner;
- public class _07_SumsStep3
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- int n = Integer.parseInt(console.nextLine());
- int sum1 = 0, sum2 = 0, sum3 = 0;
- for (int i = 0; i < n;)
- {
- if (i++ < n) sum1 += Integer.parseInt(console.nextLine());
- if (i++ < n) sum2 += Integer.parseInt(console.nextLine());
- if (i++ < n) sum3 += Integer.parseInt(console.nextLine());
- }
- System.out.printf("sum1 = %d%nsum2 = %d%nsum3 = %d%n", sum1, sum2, sum3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment