#include<iostream>
usingnamespace std;
void main ()
{
int c,rows,i,i2,r=0;
cout<<"1"<<endl;
for (rows=1;rows<=4;rows++)
{
i=1;
i2=1;
for (c=1;c<=rows;c++)
{
i = (i*10) + ++i2;
}
for (;i != 0;)
{
r= r * 10;
r= r + i % 10;
i= i/10;
}
cout<<r<<endl;
}
}
I'm a C++ beginner and I'm sure they're much simpler ways of coding for this output but I really can't figure out why this code isn't running. Anyone who can tell me where I've gone wrong?
Is your program:
1) Not compiles
* Is other code compiles correctly, i. e. is your compiler configured properly?
* If it is, give us error message and corresponding code part.
2) Not running
* Are you sure that it is not a problem with automatically closing console?
* How do you run it?
* Is there any error messages?
3) Gives an error when run
* Is it system error message or error reported in console?
* Give us error message and input which leads to error.
4) Not giving correct results
* Tell what you entered, what you expected, and what you got.
* Are you sure that results you expected are correct?