Results 1 to 2 of 2

Thread: Print Nx2 square table

  1. #1
    Join Date
    Sep 2010
    Posts
    11

    Print Nx2 square table

    **************** Print Nx2 square table *****************


    So my program is suppose to look like this...

    Number Square
    1 1
    2 4
    3 9
    4 16
    5 25
    6 36
    ...
    ...
    ...
    n n^2

    The user enters a number and the table above is suppose to display, but it doesnt... Help!! Here's what I got...




    #include<stdio.h>

    int main()
    {

    int i, num, square;

    printf("Enter a number: ");
    scanf("%d", &num);

    printf("Number\tSquare\n");

    for (i=1; i<=num; i++);
    {
    square=i*i;
    printf("%d%d\t", i, square);
    }
    }

  2. #2
    Join Date
    May 2006
    Posts
    21

    Re: Print Nx2 square table

    Try the following code:

    Code:
    #include<stdio.h>
    
    int main()
    {
    int i, num, square;
    printf("Enter a number: ");
    scanf("%d",&num);
    printf("Number\t Square\n");
    
    for (i=1; i<=num; i++);
    {
    square=i*i;
    printf("%d\t" "%d", i, square);
    }
    return 0;
    }

Similar Threads

  1. Replies: 2
    Last Post: 06-08-2012, 07:00 PM
  2. What is the program to print table of given number?
    By Roxy_jacob in forum Software Development
    Replies: 5
    Last Post: 04-09-2011, 10:40 PM
  3. Print multiplication table
    By MaryJ in forum Software Development
    Replies: 1
    Last Post: 19-11-2010, 10:26 PM
  4. How to print a Gantt Chart view without table information?
    By Leoniee in forum Windows Software
    Replies: 5
    Last Post: 19-03-2010, 04:35 AM
  5. Need list of fields of table in print
    By Murder in forum Windows Software
    Replies: 4
    Last Post: 03-09-2009, 05:17 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,514,533.97880 seconds with 17 queries