Advertisement
valve2

Lsb*Msb in a 4 digit int

Jan 18th, 2023 (edited)
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | Source Code | 0 0
  1. //this program is used to mult the first and 4th digit of 4 digit int
  2. // 7023 is used for testing
  3. #include <stdio.h>
  4. int num, num1, num2, num3, num4;
  5. int main(void) {
  6.     printf("Enter a int that consists of 4 digits\n");
  7.     scanf_s("%d", &num);
  8.     num1 = num % 10; // Lsb
  9.     printf("%d", num1);
  10.     num3 = num / 1000; //msb
  11.     printf("%d", num);
  12.     num4 = num1 * num3;
  13.     printf("the sum of * of the Lsb and Msb = \n");
  14.     printf("%d", num4);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement