关于#C++#的问题,如何解决?

题目描述

小明开始教小亮算术,小亮很快掌握了乘法,现在小明决定考考小亮的口算能力,小明给了小亮两个数 a 和 b ,小亮告诉你 a * b 的结果是 c ,你需要验证小亮算的对不对。

输入格式

本题有多组数据,共 t 组询问,每组询问给定三个正整数 a ,b ,c。

输出格式

对于每组询问,若 c = a * b ,输出 YES ,否则输出 NO 。

样例输入 #1

2
1 2 2
2 2 3

样例输出 #1

YES
NO

提示

img

img


#include<iostream>
using namespace std;
int main()
{
    int t = 0;
    int a, b, c;
    cin >> t;
    while (t--) {
        cin >> a >> b >> c;
        if (a * b == c) {
            cout << "YES";
        }
        else {
            cout << "NO" << endl;
        }
    }
}

#include<iostream>
using namespace std;
int main()
{
    int n,a,b,c;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b>>c;
        if(a*b==c)
          cout<<"YES"<<endl;
        else
          cout<<"NO"<<endl;
    }
    return 0;
}