table formatting

This is a discussion on table formatting within the C Programming forums, part of the General Programming Boards category; Code: #include <stdio.h> int main() { int w, x, y, z; printf( "N\t" ); for( w=1; w<=10; w++ ) printf( ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    115

    table formatting

    Code:
    #include <stdio.h>
    
    int main()
    {
    	int w, x, y, z;
    
    	printf( "N\t" );
    	for( w=1; w<=10; w++ )
    		printf( "%d\n", w );	
    	printf( "10*N\t" );
    	for( x=1; x<=10; x++ )
    		printf( "%d\n, x * 10 );
    	printf( "100*N\t" );
    	for( y=1; y<=10; y++ )
    		printf( "%d\n", y * 100 );	
    	printf( "1000*N\t\n\n" );
    	for( z=1; z<=10; z++ )
    		printf( "%d\n", z * 1000 );	
    	return 0;
    }
    im having trouble with this program. I just want to print numbers tabulated but it isnt working. any help would be appreciated.

    should be outputting

    N 10*N 100*N 1000*N
    1 10 100 1000
    2 20
    3
    4
    5
    6
    7
    8
    9
    10

    etc etc..
    Thanks
    there are only 10 people in the world, those who know binary and those who dont

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    115

    Thumbs up

    thanks salem!

    damn why didnt i think of that ..
    there are only 10 people in the world, those who know binary and those who dont

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing array, to file
    By zootreeves in forum C Programming
    Replies: 9
    Last Post: 09-08-2007, 05:06 PM
  2. dos game help
    By kwm32 in forum Game Programming
    Replies: 7
    Last Post: 03-28-2004, 05:28 PM
  3. progarm doesnt compile
    By kashifk in forum Linux Programming
    Replies: 2
    Last Post: 10-25-2003, 05:54 PM
  4. extra word printing
    By kashifk in forum C++ Programming
    Replies: 2
    Last Post: 10-25-2003, 04:03 PM
  5. inputting words from a file
    By kashifk in forum C++ Programming
    Replies: 5
    Last Post: 10-24-2003, 07:18 AM

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