Thread: right align

  1. #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;
    }

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You should type man 3 printf at your terminal and read what it says back.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. right align
    By major_small in forum C++ Programming
    Replies: 6
    Last Post: 05-10-2009, 07:20 PM
  2. align syntax
    By mynickmynick in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2008, 04:54 AM
  3. Using TextOut() to align positive & negative numbers
    By csonx_p in forum Windows Programming
    Replies: 4
    Last Post: 05-27-2008, 07:12 AM
  4. Left Align
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 04-29-2002, 07:47 PM
  5. how to align text?
    By kuyajay in forum C++ Programming
    Replies: 3
    Last Post: 02-22-2002, 02:51 AM

Tags for this Thread