Sum and Difference of Two Numbers

Sort by

recency

|

614 Discussions

|

  • + 0 comments

    include

    int main() { int a,b; float c,d; scanf("%d%d",&a,&b); scanf("%f %f",&c,&d); printf("%d %d",a+b,a-b); printf("\n"); printf("%0.1f %0.1f",c+d,c-d);

    return 0;
    

    }

  • + 0 comments
    #include<stdio.h>
    
    int main()
    {
        int a, b;
        scanf("%d %d", &a, &b);
        
        float c, d;
        scanf("%f %f", &c, &d);
        
        printf("%d %d\n", (a+b), (a-b));
        printf("%0.1f %0.1f", (c+d), (c-d));
        
        return 0;
    }
    
  • + 0 comments

    include

    int main() { int a, b; float x, y; scanf("%d %d", &a, &b); scanf("%f %f", &x, &y); printf("%d %d\n", a + b, a - b); printf("%.1f %.1f\n", x + y, x - y); return 0; }

    return 0;
    

    }

  • + 0 comments

    include

    int main() {

    int x;
    int y;
    scanf("%d %d", &x, &y);
    printf("%d %d\n", (x+y), (x-y));
    
    float a;
    float b;
    scanf("%f %f", &a, &b);
    printf("%.1f %.1f", (a+b), (a-b));
    
    return 0;
    

    }

  • + 0 comments
    #include <stdio.h>
    #include <string.h>
    #include <math.h>
    #include <stdlib.h>
    
    int main()
    {
        float a,b;
        int c,d;
    	scanf("%d%d%f%f", &c, &d, &a, &b);
        printf("%d %d\n%.1f %.1f", c+d, c-d, a+b, a-b);
        
        return 0;
    }