How to code a possibility integer numbers A, B for equation A+B=10

Hello,
I'm little ask my self this question,
Is't possible to program of showing possibility integer numbers ( 1,2,3 ..etc) of A, B for equation A+B=10
-- We need to make it easier to code by conditioning numbers to use from 0 to 10
A+B=10
I want from program to show only values for A, B
It could be A=9, B=1
or A=6, B=4
or A=0, B=10

답변 (1개)

Raj
Raj 2019년 3월 13일

0 개 추천

Try this:
for A=0:10
for B=0:10
if A+B == 10
disp('Combination of A and B satisfying the condition is:')
A
B
end
end
end

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

질문:

2019년 3월 13일

댓글:

2019년 3월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by