Pyramid Problem No. 5

 Q.5 Write a program to generate a following @'s triangle:

				    @
			    @	    @
		    @	    @	    @
	    @	    @	    @	    @
    @	    @	    @	    @	    @

Solving in C:
                

#include <stdio.h>

int main()

{

    int row,col;

    for(row=1;row<=5;row++){

        for(col=5;col>=1;col--){

            if(row>=col) printf("@\t");

            else printf(" \t");

        }

        printf("\n");

    }

    return 0;

}

Comments

Post a Comment

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 74

Pyramid Problem No. 85