Ok, let's dig into this.
[QUOTE=prvnkmr449;1328943]As I understand your problem is to minimize this highly nested loop which print the value of 12 variable.
[/quote]
You should note that the program calls two functions [icode]a()[/icode] and [icode]b()[/icode]. So, it is doing more than just printing out the values of variables. At any rate, yes, this seems to be the main push of the program.
[QUOTE=prvnkmr449;1328943]
Here is my very short program for that but very deep logic is behind that please try to understand the logic behind this first take look too code
[/quote]
1. Program isn't that short
2. Logic isn't that deep
3. Maybe you should present your algorithm in clearer terms instead of slapping the reader with convoluted pure C code and expecting them to follow
[CODE]
long double n_digit= 5;//0,1,2
long double n_var =4;//x,y,z
long double dif_com =pow( n_digit,n_var);
[/code]
When I got here, I knew we were in for a doozy. I notice that you are calculating the number all possible combination of n-digit numbers in a b-based numbering system. First of all, this is not necessary. Secondly, it is wrong. Let's investigate why
First look at a section of the OP's code:
[code]
for(int i=5;i>0;i--)
{
for(int j=5;j>0;j--)
{
if(j

Akill10
commented:
well said! +1

mrnutty
commented:
Nice Ascii Art and good explanation. +5

StuXYZ
commented:
Excellent! +3

Lusiphur
commented:
This should be stickied in every coding forum... +1

Ancient Dragon
commented:
Great post :) +31

Aranarth
commented:
Excellent! Now all that's left is that people read this post before starting a topic... +1

caffeine
commented:
Thank you for being patient with my stupid mistake! +1

Carrots
commented:
Thanks for helping me out. thumbsup'jpg +1

Fbody
commented:
a point for admitting your mistake +1