橘子味的心
标题:C实例 计算百分比

C实例 计算百分比

#include <stdio.h>



int main() {

   float percentage;

   int total_marks = 1200;

   int scored = 1122;



   percentage = (float)scored / total_marks * 100.0;



   printf("Percentage = %.2f%%", percentage);



   return 0;

}

目录

分类