购买书本
购买书本
描述:已知一本书的售价是30元,请编程计算购买a本书的总价是多少?
输入:输入购买书本数a
输出:输出总价
输入样例 1:1
输出样例 1:30
参考程序:
#include <iostream>
using namespace std;
int main(){
int n;//定义
int a=30;//定义
cin>>n;//输入
cout<<n*a;//计算
return 0;}
运行结果:Time: 0ms Memory: 3MB Lang: C++