Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <conio.h>
- #define n 5
- #define m 4
- int main () {
- int i, j, n_max = 0;
- float a[n][m], cache_max = 0.0;
- #include <stdio.h>
- #include <math.h>
- #include <conio.h>
- #define n 5
- #define m 4
- int main () {
- int i, j, n_max = 0;
- float a[n][m], cache_max = 0.0;
- printf("Input array a\n");
- for(i = 0; i < n; i++) {
- for(j = 0; j < m; j++) {
- scanf("%f", %a[i][j]);
- if(a[i][j] > cache_max) {
- n_max = i;
- cache_max = a[i][j];
- }
- }
- }
- float a1[m], b[m];
- for(i = 0; i < m; i++) {
- a1[i] = a[n_max][i];
- b[i] = sin(a1[i]) + cos(a1[i]);
- }
- float cache[2];
- for(i = 0; i < m; i++) {
- if(i % 2 == 0) {
- j = i - 1;
- cache[0] = a1[i]
- a1[i] = a1[j];
- a1[j] = cache[0];
- cache[1] = b[i]
- b[i] = b[j];
- b[j] = cache[1];
- }
- }
- printf("Output array a1\n");
- for(i = 0; i < m; i++) {
- printf("%.1f", a1[i];
- }
- printf("Output array b\n");
- for(i = 0; i < m; i++) {
- printf("%.1f", b[i];
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement