Advertisement
Sierra_ONE

Product From Within

Oct 8th, 2023
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | Source Code | 0 0
  1. /*
  2. 8. Product From Within
  3. I believe that there is a product in everything, most especially in two-digit integers! Each digit has a value and if you multiply each value then you would without a doubt get a product. Now go ahead and do just that
  4.  
  5. Inputs
  6. 1. The two-digit integer
  7. */
  8.  
  9.  
  10. #include <stdio.h>
  11.  
  12. int main (){
  13.    
  14.     int num,s1,s2,s3;
  15.    
  16.     printf("Etner the 2-digit integer: ");
  17.     scanf("%d",&num);
  18.    
  19.     s1 =  num % 10; // last digit
  20.     num = num / 10;
  21.     s2 = num % 10; //first digit
  22.    
  23.     s3 =  s2 * s1;
  24.    
  25.     printf("Product of %d and %d: %d",s2,s1,s3);
  26.  
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement