repeat function and calculation
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
here is my code
x=('input x')
y=x^+2
how do I ask once I get my output if I want the calculation to be repeated again
2 comentarios
Respuestas (1)
Ameer Hamza
el 8 de Mzo. de 2020
This is a general structure of what you are trying to do
condition = true;
while condition
x = input('Enter a number: ');
y = x.^2;
disp(y);
condition = input("Do you want to continue? (yes/no)\n", 's') == "yes";
end
0 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!