关于C编程的问题! [英] Problem on C programming !

查看:84
本文介绍了关于C编程的问题!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.编写一个程序,该程序接受键盘上的两个数字并打印以下信息.

变量
首先
第二
输出
第一个号码? 7
第二个数字? 2
第二个数字进入第一个Q次
余数为1.
商为3

1. Write a program that accepts two numbers from the keyboard and prints the following information.

Variables
first
second
Output
First number? 7
Second number? 2
The second number goes into first Q times
with a remainder of 1.
The quotient is 3

#include <stdio.h>
int main(void)
{
   int first;
    int second;
    int result;
    int quotient;
    printf("First number?\n");
    scanf("%d",&first);
    printf("Second number?\n");
    scanf("%d",&second);
    result = first / second;
    quotient = first%second;
    printf("The second number goes into first %d\ntimes with a remainder of %d\n");
    printf("The quotient is %d\n");
    return 0;
}



我可以知道任何地方不对吗?



may i know any place wrong? it cant show out the correct result.

推荐答案

Man!:cool:

我爱你的问题.您没有打印这些值,所以它将如何显示:laugh:

您的代码的最后两行可以解决您的问题(但只有在您给我5; P !!的情况下,我才会告诉您答案)

你去了:

Man!:cool:

I love your question. You didn''t print the values, so how will it show :laugh:

Last two lines of your code have the solution to your problem (but I will tell you the answer, only if you give me 5 ;P !!)

here you go:

printf("The second number goes into first %d\ntimes with a remainder of %d\n", first, quotient);
printf("The quotient is %d\n", result);



并且您完成了.



and you are done.


这篇关于关于C编程的问题!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆