Skip to content

Instantly share code, notes, and snippets.

@sleebapaul
Last active November 25, 2017 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sleebapaul/34cb0d4e4a039125a268f05e653cd293 to your computer and use it in GitHub Desktop.
Save sleebapaul/34cb0d4e4a039125a268f05e653cd293 to your computer and use it in GitHub Desktop.
Why all should learn how to code?
student = [‘A’, ’B’, ’C’, ’D’, ’E’];
marks = [21, 35, 13, 26, 49];
n = length(marks);
count = 0;
count1 = 0;
for i = 1:n
if marks(i) >= 25
fprintf(‘ %s has passed\n’,student(i));
count = count + 1;
else
fprintf(‘ %s has failed\n’,student(i));
count1 = count1 + 1;
end
end
fprintf(‘No. of students Passed: %d\n’,count);
fprintf(‘No. of students failed: %d\n’,count1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment