Pyramid Problem No. 68

 Q.68 Write a C program to print the following number rectangle program:

1234
2341
3412
4123

Solving iin C:

#include <stdio.h>
    int main(){
        int n=4,row,col,prnt;
        for(row=1; row<=n; row++){
            for(col=n-row+1,prnt=row; col>=1; col--,prnt++) 
                printf("%d",prnt);
            for(col=1,prnt=1; col<=row-1; col++,prnt++) 
                printf("%d",prnt);
            printf("\n");
        }
        return 0;
    }

Comments

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 74

Pyramid Problem No. 85