Sum and Difference of Two Numbers

Sort by

recency

|

608 Discussions

|

  • + 0 comments

    include

    int main () { int a=10,b=4; float c=4.0,d=2.0; printf("%d %d\n", a+b, a-b); printf("%.1f %.1f", c+d, c-d); }

    is it correct

  • + 0 comments

    why doesn't my program get it correct ? #include

    include

    include

    include

    int main() {

    int num1,num2;
    float numb1,numb2;
    scanf("%d %d", &num1,&num2);
    scanf("%f %f", &numb1,&numb2);
    
    int sum1,sum2;
    

    sum1 = num1 + num2; sum2 = num1 - num2; printf("%d %d\n", sum1,sum2); float temp1; temp1 = numb1 + numb2; printf("%.1f %.1f\n", temp1, numb2);

    return 0;
    

    }

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

    hi

  • + 0 comments

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