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

write a c++ program, that finds the minimum total number of shelves, including the initial one, required for this loading process.

write a c program to find the area under the curve4 f=(x) between x=a and x=l integrate y=(x) between the limits of a and b Solution: #include float    start_point,

Program to define an array in c: Write a program to define an array and print the value of array. void main() { int a[10]={0,11,21,34,44,75,46,57,88,89},i,j,k; clr

Project Description: We want to generate premium numbers for one of our application. What we need is: A program that generate 2, 3, 4, 5, 6, 7, 8 digits premium numbers


Define a procedure that takes three numbers as arguments and returns the sum of the squares of the two larger numbers.

Hi, Can i get a quote for my Programming assignment

I need a project on car rental system using c programming only of college level

¦It should ask customers to enter details such as their names and addresses. ¦It should print a welcome message that includes the customer’s name. ¦It should provide a list of avai