Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #define size 4
- void print2dArray(double array[][size])
- {
- for(int i = 0; i!= size ; ++i)
- {
- for(int j = 0 ; j != size; ++j)
- {
- printf("%.2lf ",array[i][j]);
- }
- printf("\n");
- }
- }
- int main()
- {
- double array[size][size];
- for(int i = 0; i!= size ; ++i)
- {
- for(int j = 0 ; j != size; ++j)
- {
- if(j == 2)
- {
- array[i][j] = 1;
- }
- else
- {
- array[i][j] = (1+j)*pow(i,2) + j;
- }
- }
- }
- print2dArray(array);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement