Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- void wypelnienie(double macierz[4][3]){
- int x, y, p=-11, q=11;
- srand(time(0));
- for (x = 0; x < 4; x++) {
- for (y = 0; y < 3; y++) {
- macierz[x][y] = p + (double) rand()/ RAND_MAX*(q-p);
- }
- }
- }
- void wypisaniePrzed(double macierz[4][3]){
- int x, y;
- printf("\n");
- for(x = 0; x<4; x++){
- for(y=0; y<3; y++)
- printf("%lf\t",macierz[x][y]);
- printf("\n");
- }
- printf("\n");
- }
- void wypisaniePo(double macierz[4][3]){
- int liczba;
- printf("Wprowadz liczbe przez ktora chcesz pomnozyc tablice \n");
- scanf("%d", &liczba);
- int x, y;
- printf("\n");
- for(x = 0; x<4; x++){
- for(y=0; y<3; y++)
- macierz[x][y] = liczba * macierz[x][y];
- }
- }
- printf("Wypisanie po przemnozeniu: \n");
- printf("\n");
- for(x = 0; x<4; x++){
- for(y=0; y<3; y++)
- printf("%lf\t",macierz[x][y]);
- printf("\n");
- }
- printf("\n");
- int main()
- {
- double macierz[4][3];
- wypelnienie(macierz);
- wypisaniePrzed(macierz);
- wypisaniePo(macierz);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement