Skip to content

Instantly share code, notes, and snippets.

@Hajto
Created October 13, 2016 21:12
Show Gist options
  • Save Hajto/a595ea5e9ba17f432f1cbb0d329921e6 to your computer and use it in GitHub Desktop.
Save Hajto/a595ea5e9ba17f432f1cbb0d329921e6 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//Wersja L
int main(){
int** matrix;
int width = 0;
int height = 0;
int counter = 0;
scanf("%d", &width);
scanf("%d", &height);
double* temp;
matrix = malloc(width * sizeof(int*));
for(int i = 0; i < width; i++){
matrix[i] = malloc(sizeof(int) * height);
for(int j = 0; j < height; j++){
printf("line %d col %d\n",i,j);
scanf("%f", &temp);
printf("Scanned:%f\n", temp);
matrix[i][j] = temp;
//matrix[i][j] = 0;
}
}
for(int i = 0; i < width; i++){
for(int j = width - i; j <= height; j++){
if(matrix[i][j] == 0){
counter++;
}
printf("%d", matrix[i][j]);
}
printf("\n");
}
for(int i = 0; i < width; i++){
for(int j = 0; j < height; j++){
printf("%d", matrix[i][j]);
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment