Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 3 4 5
- 9 2 8
- 6 4 8
- 3 4 5
- 2 8 9
- 4 6 8
- 4
- 8
- 6
- 3 4 5
- 9 2 8
- 6 4 8
- 3 2 5
- 6 4 8
- 9 4 8
- 6 4 8
- #include <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- #define n 3
- int main()
- {
- int arr[n][n],min,i,j,tmp,y,k,w,z=0,q=0;
- for(i=0;i<n;i++)
- {
- for(j=0;j<n;j++)
- {
- printf("Enter number: ");
- scanf("%d",&arr[i][j]);
- }
- }
- for(i=0;i<n;i++)
- {
- for(j=0;j<n;j++)
- {
- z = j;
- min = arr[i][j];
- for (k = j +1 ; k < n; k++)
- {
- if (arr[i][k] < min)
- {
- min = arr[i][k];
- z = k;
- }
- }
- tmp=arr[i][j];
- arr[i][j]=min;
- arr[i][z]=tmp;
- }
- }
- for(i=0;i<n;i++)
- {
- for(j=0;j<n;j++)
- printf("%d ",arr[i][j]);
- printf("n");
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement