SHARE
TWEET

Untitled

a guest Mar 25th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     //number line program
  6.     int a, b, i;
  7.     char c;
  8.     scanf("%d %d\n", &a, &b); //a is the number and b is the number to be added or subtracted
  9.     for(i=1; i<=3; i++) {
  10.         scanf("%c", &c);
  11.         if(c=='L') {
  12.             a=a-b;
  13.         }
  14.         else if(c=='R') {
  15.             a=a+b;
  16.         }
  17.     }
  18.     printf("%d", a);
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top