フィルターのクリア

How can i change number according to input by using mod ?

1 回表示 (過去 30 日間)
ahmet ozdemir
ahmet ozdemir 2016 年 5 月 4 日
編集済み: Walter Roberson 2016 年 5 月 4 日
My question is that i will give an input and if input has a single number, it will change for mod(input,10) if input has lots of numbers, it will change and write something in program like.
Enter number:-2
8
Enter number:-(9)
1
Enter number: (-4)
6
Enter number:3+(5-15)
(In modulo 10, -7 is equal to 3 same numbers)
If I give many numbers it should be like this. Thanks
  4 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 5 月 4 日
ıf someone gives lots of numbers: What does that mean ?
ahmet ozdemir
ahmet ozdemir 2016 年 5 月 4 日
編集済み: Walter Roberson 2016 年 5 月 4 日
which means that input compute more than one number.
value = input('Enter Numbers','s');
str2number(value)==equal
equall=mod(equall,10)
if equall<0
fprintf('In modulo 10, %d is equal to %d same numbers',equal,equall)
end
Something like this but I donot want single number -(9) to write like this it should show only itself
like if it is single
str2num(input)==number
equal=mod(number,10)
fprintf('%d',equal)
But program shows this sentence every time since equall<0 and it takes -9, -3, -1 by writing sentence. It should not include for one number

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by