Is It possible for while loop in for loop????????

hi everybody

I Have a code snippet as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<iostream>
using namespace std;
int main()
{
	int mul,j,k,res=0;
	for(int i=1;i<5;i++)
	{
		for(j=1;j<5;j++)
		{
			mul=i*j;
			cout<<mul<<",";
			while(mul>0)
			{
				k=mul%10;
				res=(res*10)+k;
				mul=mul/10;
				if((res>10) && (res==mul))
					cout<<res;
			}
			
		}
		cout<<"\n";
	}
	return 0;
}

is this while loop inside the for loop works?????
Actually this is program to find the product as well as palindrome of the product at the same time.

The problem is i am able to find the product but i am not getting the res to be printed ???
Can anybody help for this..................
Hello,

as far as I can tell the while loop inside for works (meaning it finally ends at some point and the program terminates). The problem is the condition for printing out res: there have to be both of your conditions true to output the result. The second one ((res==mul)) is never fulfilled so the while just loops until it gets a really small value that considers 0 and moves on.

Hope I helped.
Don't waste peoples time starting a new thread when you already had the answer in your old thread: http://cplusplus.com/forum/general/50807/
No, not possible in c++ I think.

edit: wait that's totally possible.
Topic archived. No new replies allowed.