List a = [2,3,4];
List b = [5,6,7];
I want to print 2x7, 3x6, and 4x5
CodePudding user response:
b = b.reversed.toList();
for(int i = 0 ; i < a.length ; i )
{
print(a[i] * b[i]);
}
CodePudding user response:
final a = [2, 3, 4];
final b = [5, 6, 7];
for (var i = 0; i < a.length; i ) {
final result = a[i] * b[a.length - i - 1];
print('${a[i]} * ${b[a.length - i - 1]} = $result');
}
CodePudding user response:
Try below code
void main() {
List a = [2, 3, 4];
List b = [5, 6, 7];
for (int i = 0; i < a.length; i ) {
print(a[i] * b[a.length - i - 1]);
}
}