C ++程序根据原始价格和净价格计算GST
给定原始成本和净价作为输入,任务是计算商品及服务税的百分比并显示结果
GST代表商品和服务任务。它总是包含在产品的净价中,在计算商品及服务税(GST)百分比之前,我们需要计算商品及服务税(GST)数量,为此,有可用的公式
净价=原始费用+GSTAmount
GSTAmount=净价–原成本
GST_Percentage=(GSTAmount*100)/原始费用
GST%公式=(GSTAmount*100)/原价
示例
Input-: cost = 120.00 price = 150.00 Output-: GST amount is = 25.00 % Input-: price = 120.00 cost = 100.00 Output-: GST amount is = 20.00 %
给定程序中使用的方法如下-
将输入作为净价和原始成本
应用给出的公式计算消费税百分比
显示结果
算法
Start Step 1-> declare 计算GST的功能 float GST(float cost, float price) return (((price - cost) * 100) / cost) step 2-> In main() set float cost = 120 set float price = 150 call GST(cost, price) Stop
示例
Using c++
#include <iostream>
using namespace std;
//计算GST的功能
float GST(float cost, float price) {
return (((price - cost) * 100) / cost);
}
int main() {
float cost = 120.00;
float price = 150.00;
cout << "GST amount is = "<<GST(cost, price)<<" % ";
return 0;
}输出结果
如果我们运行以上代码,它将在输出后产生
GST amount is = 25.00 %
使用C
示例
#include <stdio.h>
//计算GST的功能
float GST(float cost, float price) {
return (((price - cost) * 100) / cost);
}
int main() {
float cost = 120;
float price = 150;
float gst = GST(cost, price);
printf("GST amount is : %.2f ",gst);
return 0;
}输出结果
如果我们运行以上代码,它将在输出后产生
GST amount is : 25.00
热门推荐
10 小学毕业父母简短祝福语
11 幼儿生日祝福语模板简短
12 新娘妈妈的祝福语简短
13 邻居聚会祝福语大全简短
14 十条祝福语简短
15 给同学祝福语的简短
16 过年祝福语简短祝妈妈
17 祝女儿简短祝福语大全
18 恩师诗词祝福语简短大全