miércoles, 27 de junio de 2012

6.-Colocar el número 0 en su triangular superior.


#include <stdio.h>
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{


int A[5][5];
int i,j;
system ("color 5E");
cout<<"\n \t\t ** INGRESE LA MATRIZ ** \n";


for (i=0;i<=4;i++)
  {
 cout<<"\n";
for (j=0;j<=4;j++)
   {
cout<<"*Ingrese el valor ("<<i<<","<<j<<"):";
cin>>A[i][j];


   };
  };
cout<<"\n\t\tº MATRIZ  A(5x5) º\n";


for (i=0;i<=4;i++)
 {
cout<<"\n";
for (j=0;j<=4;j++)
   {
cout<<"\t"<<A[i][j];


}


  }
for (i=1;i<=4;i++)
  {
for (j=1;j<=4;j++)
   {
if(j>i)
{
A[i][j]=0;
       }
   }
 }
cout<<" \n\n\\nt º COLOCADO EL 0 EN EL TRIANGULAR SUPERIOR º\n";
cout<<"\nMATRIZ  5x5 \n";


for (i=0;i<=4;i++)
 {
cout<<"\n";
for (j=0;j<=4;j++)
   {
cout<<"\t"<<A[i][j];


   }


  }




getch();


}

No hay comentarios:

Publicar un comentario