Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <stdio.h>
- #include <conio.h>
- #define n 5
- int main() {
- float x[n], y[n];
- printf("Input array x\n");
- for (int i = 0; i < n; i++) {
- scanf("%f", &x[i]);
- }
- printf("Input array y\n");
- for (int i = 0; i < n; i++) {
- scanf("%f", &y[i]);
- }
- float cache;
- for(int i = 0; i < n; i++) {
- if(x[i] < y[i]) {
- cache = x[i];
- x[i] = y[i];
- y[i] = cache;
- }
- }
- int num;
- for(int i = 0; i < n; i++) {
- num = i + 1;
- printf("x%i = %f ", num, x[i]);
- printf("y%i = %f\n", num, y[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement