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 Ansicht (letzte 30 Tage)
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)]);

Akzeptierte Antwort

Chunru
Chunru am 8 Jan. 2022
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

Weitere Antworten (0)

Kategorien

Mehr zu Create Large-Scale Model Components finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by