C program to print r diagonal triangle, C/C++ Programming

C program to print R diagonal triangle:

#define rows 3

#define cols 3

void main()

{

                int i=0,j=0;

                int arr[rows][cols];

                for (i=0; i<=rows-1; i++)

                                for(j=0;j<=cols-1;j++)

                                {

                                                printf("Enter elements (%d,%d)\n",(i+1),(j+1));

 

                                                scanf("%d",&arr[i][j]);

                                }

                for (i=0; i<=rows-1; i++)

                {

                                printf("\t");       

                                for(j=0;j<3;j++)

                                                {

                                                printf("%d  ",arr[i][j]);

                                                }

                                                printf("\n");

                }

                printf("\n Revers of matrix\n");

                for(i=0;i<=rows-1;i++)

                {

                                printf("\t");

                                for(j=0;j<=cols-1;j++)

                                {

                                                if(i+j==2)

                                                printf("%d  ",arr[i][j]);

                                                else

                                                                printf("   ");

                                }

                                                printf("\n");

                }

 

 

}

 

 

Posted Date: 9/29/2012 7:19:48 AM | Location : United States







Related Discussions:- C program to print r diagonal triangle, Assignment Help, Ask Question on C program to print r diagonal triangle, Get Answer, Expert's Help, C program to print r diagonal triangle Discussions

Write discussion on C program to print r diagonal triangle
Your posts are moderated
Related Questions
The video game machines at your local arcade output coupons depending on how well you played the game, you can redeem 10 coupons for a candy bar, 6 coupons for .a medium soft drink

program of area under integration

TO CONVERT A NUMBER OR A DIGIT INTO ALPHABET


We started off taking about input, output, CPU and memory devices. Within C we need a method of storing large amounts of data in memory. We have used the idea of variables (pointer

Given a bool variable isReadable write some statements that assign true to isReadable if the file "topsecret" exists and can be read by the program and assigns false to isR

how to find the volume of cone , cylinder and sphere ?

write c++ program to decode the given code. in mobile keypad the integers from 1 to 9 will display the characters from a to z and 0 will assign a space

There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that

Which constructor gets called while I create an array of Fred objects?