Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Programming (https://www.askmehelpdesk.com/forumdisplay.php?f=437)
-   -   Nested loop (https://www.askmehelpdesk.com/showthread.php?t=384172)

  • Aug 6, 2009, 03:10 PM
    andyhaus1057
    Nested loop
    How would I design a nested loop that displays 10 rows of # characters that should be 15 # characters in each row?
  • Aug 7, 2009, 03:44 AM
    slapshot_oi
    Quote:

    Originally Posted by andyhaus1057 View Post
    How would I design a nested loop that displays 10 rows of # characters that should be 15 # characters in each row?

    [code="C"]
    #include <stdio.h>

    int main(int argc, char *argv[]) {
    int i;
    int j;

    for(i = 0; i != 10; i ++){
    printf("\n");

    for(j = 0; j !=15; j ++)
    printf("%c", '#');
    }
    }
    [/code]

  • All times are GMT -7. The time now is 06:37 AM.