[ 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

페이지 정보

작성자 웹지기 조회 2,556회 댓글 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

댓글목록

등록된 댓글이 없습니다.

전체 113건 4 페이지

이미지 목록

게시물 검색
Copyright © 즐거운 코딩 생활 ( funyphp ). All rights reserved.
PC 버전으로 보기