C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-27-2009, 07:12 PM   #1
Registered User
 
Join Date: Sep 2009
Posts: 18
Question right align

I have finished my code but want to right align my text. I have looked everywhere but can't find out how. here it is...
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   Reply With Quote
Old 09-27-2009, 07:18 PM   #2
and the Hat of Guessing
 
tabstop's Avatar
 
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   Reply With Quote
Reply

Tags
right align

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 05:00 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22