We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sum and Difference of Two Numbers
You are viewing a single comment's thread. Return to all 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);