C Programming Tutorial – 28 – How to Make a Table

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

27 responses to “C Programming Tutorial – 28 – How to Make a Table”

  1. sanyki lynch Avatar

    hey you tough great thanks

  2. nikhil raj Avatar

    i got an error…. it says "first define here" wat shall i do to solve it??

  3. Kapil Pudasaini Avatar

    my code isnt running plz help

    #include <stdio.h>
    #include <stdlib.h>
    #include<ctype.h>
    #include<string.h>
    #include<math.h>

    int main()
    {
    int columns;
    int rows;

    for(rows=1; rows>=6; rows++){
    for(columns=1; columns<=4; columns++){
    printf(" %d", columns);
    }

    printf("n");
    }
    return 0;
    }

  4. Antonio  Saldivar Avatar

    So on this same program how could I make one last column with the sum of the numbers in that row?? Someone help!

  5. Gaming Turkey Avatar

    I created an improved program. The user can now decide how many rows and columns will be printed.
    Try to run it and let me know what you think!

    #include <stdio.h>
    #include <stdlib.h>

    int main ()

    {
    int row=1;
    int column;
    int columnreq;
    int rowreq;

    printf ("How many columns do you want your table to be?n");
    scanf ("%d", &columnreq);
    printf ("nHow many rows do you want your table to be?n");
    scanf ("%d", &rowreq);
    printf ("nn");

    rows: for (column=1; column<=columnreq; column++)
    {
    printf ("* ");
    }
    row++;

    if (row<=rowreq)
    {
    printf ("n");
    goto rows;
    }
    printf ("nn");
    return 0;
    }

  6. Gordon Matthew Avatar

    Or you could do this…
    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
     printf("Namet");
     printf("Aget");
     printf("Gendern");
     printf("Joshuat");
     printf("20t");
     printf("Mn");
     printf("Jewelt");
     printf("29t");
     printf("Fn");
     printf("Gordont");
     printf("24t");
     printf("Mn");
     system("pause");
     return 0;
    }

  7. Justin Ong Avatar

    can someone help me?
    columns++ is constantly adding
    shouldn't it be
    1 2 3 4
    5 6 7 8
    9 10 11 12 etc…

  8. Ratul Asif Avatar

    didnt help at all. cant you make those tiny little words a little larger so that viewers could understand. or may be its just i am blind

  9. Alacaster Soi Avatar

    for loop ception!!!

  10. Mohammad Faruque Avatar

    #include <stdio.h>
    int main()
    {
    int birthYear, currentYear, age;
    scanf("%d", &birthYear);
    scanf("%d", &currentYear);
    age = currentYear- birthYear;
    printf("Your Age is: %dn", age);
    return 0;
    }

  11. Abdulnaser Sheikh Avatar

    At 4:27 he said this script! It's a code Bucky, this program is compiled not interpreted on runtime.

  12. jaleel williams Avatar

    how could i add an extra number (string in my case) in the first row only?

  13. Emder Avatar

    Is it console app or windows form app?

  14. finestHQ Avatar

    isn't making a table easier by using backslash t and filling in the data?

  15. BtheDestroyer Avatar

    I bought all this wood for nothing!

  16. lilo Rouif Avatar

    hahaha forloop inside a for loop… FORLOOPCEPTION XD!!! you killed me bruhh

  17. FioRazz Avatar

    How we can make a multiplication table doing this?

  18. The FUTURE Co. Avatar

    Can someone please tell me why the numbers in each row increments instead of printing 1 1 1 1, from where the code instructs the numbers to increment?

  19. Rohan Khanna Avatar

    sequence by user input

    #include<stdio.h>
    #include<stdlib.h>

    int main()
    {
    int c, r; int columns, rows;

    printf("Enter no. of rows : ");
    scanf(" %d", &rows);

    for(r = 1; r<=rows; r++){
    for(c = 1; c<=r; c++){
    printf(" %d", c);
    }

    printf("n");
    }

    }

  20. Ernie Leon Guerrero Avatar

    +thenewboston
    Bucky, you're hella funny. For-loop-ception…

    Thanks for these tutorials. Fucking better than most of the books and sites out there. Your C++ tutorial was awesome, too. I wish you made them even more complex, though. I'd watch 'em. Do you always use Bloodshed for C++ and CodeBlocks for C? Or do you ever switch it up?

  21. metaDot Avatar

    Cool I made a table but what if I want to put different values than 1234?

  22. Christopher Pilcher Avatar

    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
        int rows;
        int columns;

        printf("How many rows?n");
        scanf("%d", &rows);

        printf("How many columns?n");
        scanf("%d", &columns);

        printf(" ");
        for(int i = 0; i < columns * 3; i++)
        {
            printf("^");
        }
        printf("n");
        for(int i = 0; i < (columns * 3) + 2; i++)
        {
            printf("=");
        }
        printf("n");
        printf(" ");
        for(int i = 0; i < columns * 3; i++)
        {
            printf("=");
        }
        printf("n");
        for(int i = 0; i < rows; i++)
        {
            printf(" ");
            for(int j = 0; j < columns;j++)
            {
                printf(" # ");
            }
            printf("n");
        }
        printf(" ");
        for(int i = 0; i < columns * 3; i++)
        {
            printf("=");
        }
        printf("n");
        for(int i = 0; i < (columns * 3) + 2; i++)
        {
            printf("=");
        }
        printf("n");

        return 0;
    }

    Build your own temple, guys!

  23. Sn0w CrAB Avatar

    XD this video is made exactly a year and 10 mins ago

  24. Theodoro DaVinci Avatar

    Can we make a christmas tree at code blocks?
    something like this but without spaces between each line

                                    *
                                   ***
                                  ***
                                 *****
                                ******* 
                                   ***
                                   ***
                                   ***

  25. Theodoro DaVinci Avatar

    how we can make a christmas tree??

  26. SIA Avatar

    Question # 5 [10 points]
    Write a C program that asks the user to enter an integer number n and displays the multiplication table for numbers 1 to n. Display each number in 3 places. The output of your program should be as follows for n = 5:

     

    #include <stdio.h>
    int main ()
    {
    int n, i, j;
    printf("Enter a number: ");
    scanf("%d", &n);
    printf("   ");
    for (i = 1; i <= n; i++)
    printf("%3d",i);
    printf("n");
    for (i = 1; i <= n; i++){
    printf("%3d", i);
    for (j = 1; j <= n; j++)
    printf("%3d", i*j);
    printf("n");
    }
    return 0;
    }

  27. maritt dina Avatar

    Could somebody please tell me how to make the table by a 2-D array? Here is my code, but its not working properly:

     #include<stdio.h>
    #include <stdlib.h>
    #include<math.h>

    int i,j;
    int t[5][3];
    int main(){
    for (i=0; i<5; i++){
    for (j=0; j<3; j++){
    scanf(" %d t", &t[i][j]);
    }

    }
    printf("the table is: %d", t[i][j]);
    return 0;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *