I want to write a program that prints the possible combinations of two digits, where the output prints the smallest combination of two digits (eg: 34, 43 are combinations of two digits and are considered the same combination of digits, but only 34, the smaller value gets printed), must be in ascending order and the two digits must be different.
Also, I'm not to use printf, but putchar, Values 0 - 9
#include <stdio.h>
int main(void)
{
int a, b;
for (a = 0; a < 10; a++)
{
for (b = 0; b < 10; b++)
{
printf("%d", a);
printf("%d", b);
putchar(',');
}
}
printf("\n");
return (0);
}
This is all I know and what I've tried. I'm just two days into C, so please... Thanks