0

I just wrote a code for multiplication for input of any number till the 20 multiples .

// the multiplication table of any input number till its 20 multiples #include <iostream> using namespace std; int main() { int num; cout<<"The Multiplication table of "; cin>>num; int numstatic=num; int multiple=0; cout<<num<<" till it 20 Multiples is \n"; while (num < numstatic*20+1) { multiple ++; cout<<numstatic<<"×"<<multiple<<"="<< num << endl; num = num + numstatic; } return 0; } Everything works fine when I remove cin and put some value of num but when I make num as input by putting cin as in the code it gives out of some number like 32627

26th Sep 2020, 12:15 PM
Aquib
Aquib - avatar
6 Respostas
+ 2
Aquib Javid Mir oh ok I didn't understood the question really ,
26th Sep 2020, 2:16 PM
Abhay
Abhay - avatar
+ 1
The code that you have in your description works fine for me , not sure what you are taking about
26th Sep 2020, 12:33 PM
Abhay
Abhay - avatar
+ 1
Abhay actually while after I run the code I get output as 32627×1 32627×2..... However ,shouldn't I get the output as 0×1 0×2..... Because there is not input till now
26th Sep 2020, 12:46 PM
Aquib
Aquib - avatar
0
That's a garbage value. That you will get, if you not assigning value before using it..
26th Sep 2020, 1:43 PM
Jayakrishna 🇮🇳
26th Sep 2020, 2:10 PM
Aquib
Aquib - avatar
0
You're welcome..
26th Sep 2020, 2:54 PM
Jayakrishna 🇮🇳