Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

how to code this

조회 수: 1 (최근 30일)
Sinan Sahiner
Sinan Sahiner 2020년 5월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
x=input
y=input
with using if and for
-summation of numbers beetwen x and y
-average of numbers beetwen x and y
-finding how many numbers there are in beetwen x and y
-generate 5 random numbers beetwen x and y
with using if and while
-summation of numbers beetwen x and y
-average of numbers beetwen x and y
-finding how many numbers there are in beetwen x and y
can you help me with this quiz (matlab)
  댓글 수: 3
Paresh yeole
Paresh yeole 2020년 5월 5일
with using if and for
% Assumption that x and y are integers and y>x
%summation of numbers beetwen x and y
sum= 0
for i=x:1:y
sum = sum +i;
end
%average of numbers beetwen x and y
avg = sum/(y-x+1);
%finding how many numbers there are in beetwen x and y
numbers = y-x+1;
%generate 5 random numbers beetwen x and y
% Assuming the difference is greater than 5
randnum = ranperm(y-x) +x;
Similarly can be done for while
Sinan Sahiner
Sinan Sahiner 2020년 5월 5일
thank you ! , as a beginner i would be grateful if you can help me with while too

답변 (1개)

Guru Kumaresan
Guru Kumaresan 2021년 7월 13일
Hi Sinan,
It seems you are new to MATLAB programming. To start with programming in MATLAB you can start with MATLAB Onramp course – MATLAB Onramp
After completing it, to get some more knowledge on MATLAB you can go for a course for MATLAB fundamentals - MATLAB fundamentals

이 질문은 마감되었습니다.

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by