Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include <math.h>
- #define N 100
- void swap(double a[N], int n) {
- int i =0;
- for (i = 0; i < n; i += 2){
- double tmp = a[i];
- a[i] = a[i + 1];
- a[i + 1] = tmp;
- }
- for (i = 0; i < n; i++){
- printf("lg", a[i]);
- }
- }
- int main(){
- double a[N];
- int n, i;
- printf("Input the size of the massiv: ");
- scanf("%d", &n);
- for (i = 0; i < n; i++) {
- printf("a[%d] = ", i);
- scanf("%lg", &a[i]);
- }
- swap(a, n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement