필터 지우기
필터 지우기

How to get the the program to stop?

조회 수: 3 (최근 30일)
Aaron
Aaron 2012년 7월 12일
I'm creating a program and need it to stop at a prompted number.
if true
% code
end
*n = input('Enter number of grades in range: ');
while n<0
x=input('Enter grade(0 to 100): ');
if x >= 90
fprintf('Grade = %0.0f,A\n',x)
elseif x >= 80
fprintf('Grade = %0.0f,B\n',x)
elseif x >= 70
fprintf('Grade = %0.0f,C\n',x)
elseif x >=60
fprintf('Grade = %0.0f,D\n',x)
else
fprintf('Grade = %0.0f,F\n',x)
end
if x<0
end
end*
After prompting the user to enter the number of grades, n, I need my while loop to stop after that number of entries of x.
Could I use an array for this? Or is what I have okay?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by