+ 2
Question!
Hi! My first post. Someone can explain me this? if (y>ages[x]) { y=ages[x]; } đ https://code.sololearn.com/cWBKCc6ZqgZw/?ref=app
6 Answers
+ 3
if y value is greater than ages[x] then set y to ages[x]; smaller value..
May be snippet from : Find smallest among ages in array ages[]
+ 2
Jayakrishnađźđł I think I finally understood! Thank you!
+ 1
First line:
int ages[5];
Creats 5 memory locations for ages
{[ages[0]],[ages[1]],[ages[2]],[ages[3]],[ages[4]]}
Your code then sets each location to what the user enters:
for (int i=0; i < 5; ++i)
{
cin>>ages[i];
}
Request memory locations of type float for edades & act
float edades;
float act;
edadaes value is set to the same thing [ages[0]] is
edades = ages[0];
Using a for loop it looks at [ages[x]] and compares it to adades
so instead of x it will be ages[0], ages[1].. etc.
for (int x=1; x < 5; ++x)
{
if (edades > ages[x])
{
edades = ages[x];
}
+ 1
William Owens Thank you!
+ 1
That can be write in more readable way simply is like :
if( ages[x] < min)
min = ages[x]; //take less value among two
Dana You're welcome
0
Description:You are required to write a serial program that performs multiplication for two n-digits decimal integers using the basic simple algorithm you learned in primary school.This is solo homework âno teams.Tasks:1.You will be given the file serial.c, put all of your code there. Do not create any additional files. 2.Use the below examples to test the correctness of your code.
just use loop and method.