Generation

language from codeMon, 09 Jan 2023

Create C++ program to calculate which of the given three natural numbers contains the biggest amount of digits ‘1’. For the solution, you should create a function, which calculates the result as a return value.

#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if(a == 0){ if(b == 0){ if(c == 0){ cout << 0; } else { cout << 1; } } else { cout << 2; } } else { cout << 3; } }

Questions about programming?Chat with your personal AI assistant