% This program calculates the amount of pasta to cook, given the number of people eating.
Author: Ettore Boyardee
numPeople = 2 // numPeople: Number of people that will be eating
totalOuncesPasta = numPeople * 3; % Calculate and print total ounces of pasta
Typical: 3 ounces per person %

댓글 수: 3

Aqila
Aqila 2023년 8월 13일
편집: Torsten 2023년 8월 13일
the symtax 5p^3 give an error in matlab please select the option that is correct for this error
1). 5*.p^3
2). 5*p^3
3). 5p.^3
4). 5multiply p^3
Walter Roberson
Walter Roberson 2023년 8월 13일
There are circumstances under which none of those answers are correct.

댓글을 달려면 로그인하십시오.

 채택된 답변

James Tursa
James Tursa 2017년 9월 15일
편집: James Tursa 2017년 9월 15일

1 개 추천

Each comment section on a line needs to start with the % character.
The C/C++ style of commenting with // does not work with MATLAB. Use the % character.
E.g.,
% This program calculates the amount of pasta to cook, given the number of people eating.
% Author: Ettore Boyardee
numPeople = 2; % numPeople: Number of people that will be eating
totalOuncesPasta = numPeople * 3; % Calculate and print total ounces of pasta
% Typical: 3 ounces per person %

댓글 수: 1

Walter Roberson
Walter Roberson 2017년 9월 15일
Octave permits // comments. If you are using Octave then this is not the proper support resource: the behaviour of Octave is not always the same as MATLAB.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jilesh Dilipbhai
Jilesh Dilipbhai 2023년 1월 26일

0 개 추천

% This program calculates the amount of pasta to cook, given the number of people eating.
% Author: Ettore Boyardee
numPeople = 2; % numPeople: Number of people that will be eating
totalOuncesPasta = numPeople * 3; % Calculate and print total ounces of pasta
% Typical: 3 ounces per person %

카테고리

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

태그

질문:

2017년 9월 15일

댓글:

2023년 8월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by