Commit 673ce6bd by videid

hw2 1st

parent 44d03905
Showing with 58 additions and 0 deletions
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void size(int* rows,int* columns);
void fill(int rows,int columns);
int main(void){
int rows ;
int columns ;
size(&rows,&columns);
fill(rows,columns);
return 0 ;
}
void size(int *rows,int *columns){
*rows = 0;
*columns =0 ;
while(*rows<= 0) {
printf("enter number of rows\n");
scanf("%d", rows);
}
while(*columns <= 0) {
printf("enter number of columns\n");
scanf("%d", columns);
}
printf("%d rows %d columns \n",*rows,*columns);
}
void fill(int rows,int columns){
int h;
int i;
int j;
int myArray[rows][columns];
for (i=0 ;i< rows ;i++){
for(j=0;j<columns;j++){
printf("enter number \n");
scanf("%d", &h);
myArray[i][j] = h;
}
}
for (i=0 ;i< rows ;i++){
for(j=0;j<columns;j++){
printf("%d",myArray[i][j]);
}
printf("\n");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment