Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void main(void)
- {
- int nNum, j, i, n, c = 5;
- printf("Please enter integer : ");
- while(scanf("%d", &nNum) != 1 || nNum < 0)
- {
- _flushall();
- printf("Please enter integer : ");
- }
- for(j = 1; j <= nNum; j++)
- {
- if(nNum > 3)
- {
- if(j <= 3)
- {
- for(i = 1; i <= nNum*2 - j*2 + 2; i++)
- printf(" ");
- }
- else if(j > 3 && j != nNum)
- {
- for(i = 1; i <= nNum*2 - j*2 + 1; i++)
- printf(" ");
- }
- else
- {
- for(i = 1; i <= nNum*2 - j*2; i++)
- printf(" ");
- }
- }
- else
- for(i = 1; i <= nNum*2 - j*2; i++)
- printf(" ");
- n = 1;
- for(i = 1; i <= j; i++)
- {
- printf("%d ", n);
- n+= j-1;
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement