็How to convert c++ to matlab fromthis code

#include<stdio.h>
int main(){
int i=1,number=0,b=9;
printf("Enter a number: ");
scanf("%d",&number);
while(i<=10){
printf("%d \n",(number*i));
i++;
}
return 0;
}

2 件のコメント

Yalaw M.
Yalaw M. 2021 年 2 月 11 日
and this another code
// C program to illustrate while loop
#include <stdio.h>
int main()
{
// initialization expression
int i = 1;
// test expression
while (i > -5) {
printf("%d\n", i);
// update expression
i--;
}
return 0;
}
Walter Roberson
Walter Roberson 2021 年 2 月 11 日
What have you reached so far? It would be a waste to write a semester's worth of lectures on binary arithmetic if you simply forgot for a moment that I recommended that you read the matlab documentation about "while"

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

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 2 月 11 日

0 投票

There is no matlab equivalent of that code. That code relies on the standard input stream, but matlab does not have input streams.
meanwhile research input() and while and fprintf()

カテゴリ

タグ

質問済み:

2021 年 2 月 11 日

コメント済み:

2021 年 2 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by