Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n1, n2, sum;
- cin >> n1 >> n2 >> sum;
- int expected_sum = n1 + n2;
- if (sum != expected_sum) {
- cout << "Error. The sum of "s << n1 << " and "s << n2 << " is "s << expected_sum << endl;
- }
- }
Advertisement
Comments
-
- #include <iostream>
- using namespace std;
- int main() {
- int number_1, number_2, sum;
- cin >> number_1 >> number_2 >> sum;
- int current_sum = number_1 + number_2;
- if (number_1 + number_2 != sum) {
- cout << "Error. The sum of "s << number_1 << " and "s << number_2 << " is "s << current_sum << endl;
- }
- return 0;
- }
-
- #include <iostream>
- using namespace std;
- int main() {
- int x, y, sum;
- // Считайте три целых числа: X и Y и их сумму
- cin >> x >> y >> sum;
- // Если сумма указана неверно, выведите сообщение: "Error. The sum of X and Y
- // Вместо символов X, Y и Z выведите числа X и Y, а также правильное значение суммы
- if ( (x + y) != sum ){
- cout << "Error. The sum of "s << x << " and "s << y << " is "s << x + y;
- }
- }
-
- // Почему этот код не проходит, а проходит какой то левый код???
- #include <iostream>
- using namespace std;
- int main() {
- long double x, y, z;
- cin >> x >> y >> z;
- long double r = x + y;
- if (r != z) {
- cout << "Error. The sum of "s << x << " and "s << y << " is "s << r << endl;
- }
- }
- // тот самый левый код.....................
- #include <iostream>
- using namespace std;
- int main() {
- int x,y,z,sum,w;
- cin>>x>>y>>z;
- w=x+y;
- sum=z;
- if(x+y!=sum)
- {
- cout<<"Error. The sum of "<< x << " and "<< y << " is " << w <<endl;
- }
- else {
- cout<<"";
- }
- return 0;
- }
- // так... я понял почему не работало, я косякнул, с кем не бывает, но на эмуляторе все работало стабильно... хз чем не понравилось забивание через сайт
-
- #include <iostream>
- using namespace std;
- int main() {
- int x, y, z ;
- cin >> x >> y >> z;
- int r = x + y;
- if ((x + y) != z){
- cout << "Error. The sum of "s << x << " and "s << y << " is "s << r << endl;
- }
- }
- // теперь и мой прошел
Add Comment
Please, Sign In to add comment