Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int i,j, a[10][10],count,choice;
- void one()
- {
- for(i=0;i<5-1;i++)
- {
- for (j=0; j<4-i; j++)
- {
- a[i][j]=1;
- }
- }
- }
- void two()
- {
- for (i=0; i<5; i++)
- {
- for (j=0; j<5; j++)
- {
- if(a[i][j]!= 1)
- a[i][j] = -1;
- }
- }
- }
- void three()
- {
- count = 4;
- for(i=0;i<5;i++)
- {
- a[i][count]=0;
- count--;
- }
- }
- int main()
- {
- one();
- two();
- three();
- printf("The matrix is:-\n");
- for (i = 0; i<5; i++)
- {
- for (j=0; j<5; j++)
- printf("\t%d\t",a[i][j]);
- printf("\n");
- }
- }
- //Output
- //The matrix is:-
- // 1 1 1 1 0
- // 1 1 1 0 -1
- // 1 1 0 -1 -1
- // 1 0 -1 -1 -1
- // 0 -1 -1 -1 -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement