top of page
Search

A C program that will print number pyramid pattern

  • Writer: Nelson John
    Nelson John
  • Nov 27, 2017
  • 1 min read

#include<stdio.h>

#include<conio.h>

int main() {

int i, num, j, xpos = 30, ypos = 10;

clrscr();

printf("Enter n (between 2 & 9) : ");

scanf("%d", &num);

for (i = 1; i <= num; i++) {

gotoxy(xpos, ypos);

for (j = 1; j <= i; j++)

printf("%d ", i);

xpos = xpos - 1;

ypos++;

}

return (0);

}

Facebook: ayamnelrodinho1@gmail.com

Yahoo: talk2nelsonjohn2dat@yahoo.com

Whatsapp: +2349034595610

PLEASE KINDLY SHARE WITH FELLOW PROGRAMMERS AND ALSO SUBSCRIBE TO MY BLOGs PAGE FOR MORE FEEDS.


 
 
 

Comentarios


bottom of page