[ java ] JavaFestival1 - Question3 (77*1) + (76*2) + (75*3)+...+(1*77)를 계산하여 결과 출력 > java

본문 바로가기
사이트 내 전체검색

java

[ java ] JavaFestival1 - Question3 (77*1) + (76*2) + (75*3)+...+(1*77)…

작성자 웹지기
작성일 20-12-19 00:19 | 조회 4,770 | 댓글 0

본문

Question 3 

 - (77*1) + (76*2) + (75*3)+...+(1*77)를 계산하여 결과를 출력하시오

 

public class Question3 {

    public static void main(String[] args) {

        int tot = 0;

        for(int i=77, j=1; i>=1; i--, j++) {

            tot += (i*j);

            //System.out.println("("+i+"*"+j+")");

        }

        System.out.println(tot);

    }

 

결과

79079


0 0

댓글목록 0

등록된 댓글이 없습니다.

java 목록

Total 113
게시물 검색

회원로그인

접속자집계

오늘
20,195
어제
20,569
최대
61,067
전체
18,379,013

그누보드5
Copyright © funyphp.com. All rights reserved.