Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void readtab(float x[][100], int n, int m){
- int i,j;
- for (i=0;i<n;i++){
- for (j=0;j<m;j++){
- printf(" x[%d][%d]=",i,j);
- scanf("%f",&x[i][j]);
- }
- }
- }
- void showtab(float x[][100], int n, int m){
- int i,j;
- printf("\n");
- for (i=0; i<n; i++){
- for (j=0; j<m; j++ ){
- printf(" %.0f ",x[i][j]);
- }
- printf("\n");
- }
- printf("\n");
- }
- void vector(float x[][100], float B[5000],int n, int m){
- int A = 0;
- int i,j;
- for(j = 0; j < m; j++){
- if (x[0][j]){
- B[A++] = x[i][j];
- }
- }
- }
- void vectorSecond(float x[][100], float B[5000],int n, int m){
- int A = 0;
- int i,j;
- for(j = 0; j < n; j++)
- for(i = n-1; i < m; i++){
- if (x[i][j]){
- B[A++] = x[i][j];
- }
- }
- for (i = 0; i < A; i++){
- if(B[i]==0){
- break;
- }
- printf(" %.0f ", B[i]);
- }
- }
- void showvector(float B[5000]){
- int i,j;
- int A;
- printf("\n Elementele Vectorului B sunt: ");
- for (i = 0; i < A; i++){
- if(B[i]==0){
- break;
- }
- printf(" %.0f", B[i]);
- }
- }
- int main(){
- float x[100][100],B[5000];
- int n,m;
- printf("\n Dati numarul de linii: ");
- scanf("%d", &n);
- printf("\n Dati numarul de coloane: ");
- scanf("%d", &m);
- printf("\n");
- readtab(x,n,m);
- showtab(x,n,m);
- vector(x,B,n,m);
- showvector(B);
- vectorSecond(x,B,n,m);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement