How to create a program that repeats itself?
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Scripts dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!