How to create a program that repeats itself?
古いコメントを表示
I want this program to repeat itself after giving an output (ask input again and calculate again). I don't know how to do that can someone help me?
t=36; %total number of lectures
b=0;
while b==0
p=input('Enter Number of Lectures Attended \n');
if p>36
fprintf('Error, note that the total number of lectures are 36. \n')
else
b=1;
end
end
a=(p/t)*100; % this calculates the percentage attendance
if a>=75
fprintf('The student does not have short attendace. \n')
else
fprintf('The student has short attendace. \n')
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Scripts についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!