Sum and Difference of Two Numbers

  • + 0 comments

    int a,b; printf("enter a number"); scanf("%d", &a); printf("enter a number"); scanf("%d", &b); printf("the sum is: %d\n", a+b); printf("the diff is: %d\n", a-b);

    float c,d;
    printf("enter a number");
    scanf("%f", &c);
    printf("enter a number");
    scanf("%f", &d);
    printf("the sum is: %f\n", c+d);
    printf("the diff is: %f\n", c-d);