乎乎喜欢编程,他今天计划编程t小时,计划编写n道题目,每道题需要m分钟完成。请输出题目完成情况:如果完成0道或1道题,则输出“He wrote 0 programming question, and left n programming questions for tommorrow.” 或 “He wrote 1 programming question, and left n-1 programming questions for tommorrow.”。如果完成x(x≥2)道题输出,则输出“He wrote x programming questions, and left n - x programming questions for tommorrow.
#include <stdio.h>
int main()
{
float t,x;
int n,m;
scanf("%f%d%d",&t,&n,&m);
x=(60*t)/m;
if(x<2)
printf("He wrote 0 programming question, and left n programming questions f3or tommorrow.||He wrote 1 programming question, and left n–1 programming questions for tommorrow.",x);
if(x>=2)
printf("He wrote %d programming question, and left n-%d programming questions for tommorrow.",x);
return 0;
}
请问大佬,这个哪里出错了?
x=0和1你要分开写输出语句,完成1个时要提示还有n一个1个未完成。大于1时有两个%d,尔后面需要两个x。另外n不能写在字符串,要用输入的n替换啊
#include <stdio.h>
int main()
{
int t,x,n,m;
scanf("%d%d%d",&t,&n,&m);
x=(60*t)/m;
printf("He wrote %d programming question, and left %d programming questions f3or tommorrow",x,n-x);
return 0;
}