![]() |
| | #1 |
| Registered User Join Date: Sep 2009
Posts: 18
| Code:
#include<stdio.h>
#define MAX_N 10
#define MAX_P 5
/*
* Main function
*/
int main()
{
{
printf(":::: \tTable of Powers\t ::::\n");
printf("Integer Square 3rd power4th power5th power\n");
printf("-----\t-----\t-----\t-----\t-----\n");
}
int tab[MAX_N + 1][MAX_P + 1];
int N, P;
for (N = 1; N <= MAX_N; N++)
{
tab [N][0] = 1;
for (P = 1; P <= MAX_P; P++)
tab[N][P] = N * tab[N][P - 1];
}
for (N = 1; N <= MAX_N; N++)
{
for (P = 1; P <= MAX_P; P++)
printf ("%6d ", tab[N][P]);
printf ("\n");
}
return 0;
}
|
| ke121885 is offline | |
| | #2 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| You should type man 3 printf at your terminal and read what it says back. |
| tabstop is offline | |
![]() |
| Tags |
| right align |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| right align | major_small | C++ Programming | 6 | 05-10-2009 07:20 PM |
| align syntax | mynickmynick | C++ Programming | 5 | 08-28-2008 04:54 AM |
| Using TextOut() to align positive & negative numbers | csonx_p | Windows Programming | 4 | 05-27-2008 07:12 AM |
| Left Align | Unregistered | C++ Programming | 1 | 04-29-2002 07:47 PM |
| how to align text? | kuyajay | C++ Programming | 3 | 02-22-2002 02:51 AM |