Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include <stdlib.h>
- int main()
- {
- int n,a,b, i;
- float sum = 0, x;
- printf("Enter number of elements: ");
- scanf("%d", &n);
- printf("\n\n\nEnter %d elements\n\n", n);
- int max = 0;
- for(i = 0; i < n; i++)
- {
- scanf("%d%d", &a, &b);
- if(a > b)
- {
- sum = a - b;
- }
- else sum = b-a;
- if(sum > max)
- {
- max = sum;
- }
- }
- printf(" %d", max);
- return 0;
- }
Add Comment
Please, Sign In to add comment