not providing a fixed input

2 vues (au cours des 30 derniers jours)
NAVNEET NAYAN
NAVNEET NAYAN le 24 Juil 2018
suppose I write a code:
function c=sum_of_two_numbers(a,b)
a=7;
b=8;
c=a+b;
end
here I have provided values of a and b. I want that whenever I run this code one should be asked to enter values of a and b and then getting C after entering a and b.

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 24 Juil 2018
function c=sum_of_two_numbers(a,b)
a=input('Enter the 1st Number \n');
b=input('Enter the 2nd Number \n');
c=a+b;
fprintf('The result is %f',c);
end
  2 commentaires
NAVNEET NAYAN
NAVNEET NAYAN le 24 Juil 2018
Yes, this is working well. Thanks Kalyan..
KALYAN ACHARJYA
KALYAN ACHARJYA le 24 Juil 2018
Modifié(e) : KALYAN ACHARJYA le 24 Juil 2018
Welcome..

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by