Advertisement
ULK

Лабораторная №8 (6.47а)

ULK
Nov 30th, 2022 (edited)
1,323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, b;
  8.     int product = 1;
  9.    
  10.     cout << "Enter the number n: ";
  11.     cin >> n;
  12.    
  13.     cout << "Enter the number b: ";
  14.     cin >> b;
  15.    
  16.     while (n>0){
  17.         product = product * n%10;
  18.         n = n/10;
  19.     }
  20.    
  21.     if (product>b){
  22.         cout << "The product of n's digits is _greater_ than b";
  23.     }
  24.     else{
  25.         cout << "The product of n's digits is _lower_ than b";
  26.     }
  27.    
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement