Advertisement
valve2

s1mple int print

Jan 24th, 2023
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. //s1mple prog that asks for a 3 digit int | 915 | & prints abc each on \n
  2. #include <stdio.h>
  3. int a, b, c, num;
  4. int main() {
  5.     puts("Enter a intger");
  6.     scanf_s("%d", &num);
  7.  
  8.     a = num / 100;
  9.     printf("%d\n", a);
  10.    
  11.     b = num / 10;
  12.     b = b % 10;
  13.     printf("%d\n", b);
  14.     c = num % 10;
  15.     printf("%d\n", c);
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement