Write a C++ program to compute the sum of the two given integers and count the number of digits of the sum value

  • برمجة سي بلس بلس

Write a C++ program to compute the sum of the two given integers and count the number of digits of the sum value

Sample Output:

Sample input : 15 20
Sample Output:
2

الأجوبة

#include <iostream>
#include <sstream>
using namespace std;
int main() {
    int x, y;
    while (cin >> x >> y) {
        stringstream str1;
        str1 << x + y;
        cout << str1.str().size() << endl;
	}
    return 0;
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...