A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

pattern program 11 (C language)
Q:

pattern program 11 (C language)

0

pattern program 11 (C language)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program - 11

/*
C program to print following pyramid
123454321
 1234321
  12321
   121
    1
*/

#include <stdio.h>

int main()
{
    int i,j;
    int space=0;
    
    /*Run parent loop*/
    for(i=5; i>=1; i--)
    {
        /*Print space*/
        for(j=1; j<=space; j++)
            printf(" ");
        
        
        /*Run loop to print first part of row*/
        for(j=1; j<=i; j++)
            printf("%d",j);
        
        /*Run loop to print second part of row*/
        for(j=i-1; j>=1; j--)
            printf("%d",j);
            
        printf("\n");
        space++;
    }

    return 0;
}

Output

    123454321
     1234321
      12321
       121
        1

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now