+ 2

Why it doesn't gives output of more than 8*a for any no.?pls need help

printing table https://code.sololearn.com/cUen5vODgwQH/?ref=app

25th Apr 2019, 6:01 AM
Abhay
Abhay - avatar
8 Respuestas
+ 1
In void display () for loop needs to go to n, not a. You ask user to input number cin>> n but you are not using it anywhere.
25th Apr 2019, 6:08 AM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 1
Your multiplication method is off. It's not logical to me. You just can't use a and n without having some if statement to check the input value of n. Even then, you'll have to check the value as well in display method. Number 8 is a random number in the memory. It could be any number really.
25th Apr 2019, 6:44 AM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 1
dρlυѕρlυѕ ,no problems now ,I removed that second function which I thought isn't really necessary ,works as I wanted
25th Apr 2019, 6:52 AM
Abhay
Abhay - avatar
0
dρlυѕρlυѕ cout<<"table is as follow"<<n<<"*"<<i<<"="<<n*i;
25th Apr 2019, 6:24 AM
Abhay
Abhay - avatar
0
dρlυѕρlυѕ ,why doesn't this Loop runs to 10 for a ,while it works perfectly for n?
25th Apr 2019, 6:29 AM
Abhay
Abhay - avatar
0
dρlυѕρlυѕ , thks but this is weird why does it takes 8 as value for any value passed to a variable?
25th Apr 2019, 6:36 AM
Abhay
Abhay - avatar
0
dρlυѕρlυѕ Why it's a simple program where it takes the default argument value and prints the table for it upto the no. user inputs?
25th Apr 2019, 6:48 AM
Abhay
Abhay - avatar
0
dρlυѕρlυѕ it assigns 5 to a ,so why 8 then?
25th Apr 2019, 6:49 AM
Abhay
Abhay - avatar