Hi, I want to make the final output to 4 decimal places. But it kept showing only 1. I tried a lot but doesn't work. Please help me

조회 수: 1 (최근 30일)
Ass_1 = input("Lab Assignment #1:");
Ass_2 = input("Lab Assignment #2:");
Ass_3 = input("Lab Assignment #3:");;
%Quizzes
quiz_1 = input("Quiz 1:");
quiz_2 = input("Quiz 2:");
quiz_3 = input("Quiz 3:");
final_exam = input("Final Exam:");
disp([('Your calculated final mark for is '),num2str(totalass*60/100+totalquiz*10/100+final_exam*30/100)]);

채택된 답변

Chunru
Chunru 2022년 1월 8일
Ass_1 = 60;
Ass_2 = 75;
Ass_3 = 80;
totalass = (Ass_1 +Ass_2 + Ass_3)/3;
%Quizzes
quiz_1 = 76;
quiz_2 = 90;
quiz_3 = 54;
totalquiz = (quiz_1 + quiz_2 + quiz_3)/3;
final_exam = 73;
finalmark = totalass*60/100+totalquiz*10/100+final_exam*30/100;
fprintf('Your calculated final mark for is %.1f\n', finalmark);
Your calculated final mark for is 72.2

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by