[1][I write a simple program in dart to print multiplication table but the output was not I Except][1]
void main{
int num=10;
for(var i=1;i<=10;++i){
print('$num*$i=$num');
}
}
this was my code
You forget to add the parenthesis in the main function which acted like a function declaration.
And you also missed to multiply the result of the multiplication by i.
The correct code is :
void main(){
int num=10;
for(var i=1;i<=10;++i){
print('$num*$i=${num*i}');
}
}
instead of this:
void main{
int num=10;
for(var i=1;i<=10;++i){
print('$num*$i=$num');
}
}