微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

计算季度的总收入并输出

#include <stdio.h>

int main(void)
{
  const float Revenue_Per_150 = 4.5f;
  unsigned int PC =11111110;                           // Stock sold in January
  unsigned int Memory =22222220;                           // Stock sold in February
  unsigned int Keyboard =33333330;                           // Stock sold in march
  float  RevQuarter = 0.0f;                                // Sales for the quarter

  unsigned long QuarterSold = PC + Memory + Keyboard; // Calculate quarterly total

  printf(Stock sold in\n Jan: %d\n Feb: %d\n Mar: %d\n, PC, Memory, Keyboard);
  printf(Total stock sold in first quarter: %ld\n, QuarterSold);


  RevQuarter = QuarterSold / 150 * Revenue_Per_150;
  printf(Sales revenue this quarter is:$%.2f\n, RevQuarter);
  return 0;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐