1 2 3 4
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
That's all I have to add to finish the program. Help, please? Here's what I've got so far:
#include <stdlib.h>
#include <stdio.h>
int main ()
{
int sides;
int d1, d2;
printf("How many sides are on your dice?\n");
scanf("%d", &sides);
if ((sides < 4) || (sides > 12))
{
printf("Invalid Entry.\n");
}
else
{
for (d1 = 1; d1 <= sides; d1++)
{
for (d2 = 1; d2 <= sides; d2++)
{
printf ("%4d", d2+d1);
}
printf("\n"); //a new line
}
}
getchar();
getchar();
return 0;
}
*Mod Edit: added code tags: :code:
This post has been edited by NickDMax: 01 March 2008 - 06:38 PM

New Topic/Question
Reply



MultiQuote




|