这题主要考察对C语言输入输出的运用。代码如下:
#include "stdio.h"
#include "math.h"
#include "conio.h"
main()
{
int i,j;
long a,b,c,d,e;
printf("please input two numbers:n");
scanf("%d%d",&i,&j);
a=i+j;
b=i*j;
c=i-j;
d=i/j;
e=i%j;
printf("%dn%dn%dn%dn%dn",a,b,c,d,e);
getch();
}
扩展资料
C语言输入输出函数:
C语言无I/O语句,I/O操作由函数实现
#include
a、字符输出函数putchar
格式: putchar( c );
参数: c为字符常量、变量或表达式。
功能:把字符c输出到显示器上。
返值:正常,为显示的代码值;
b、格式输出函数printf
格式:printf(“格式控制串”,输出表);
功能:按指定格式向显示器输出数据。
输出表:要输出的数据。
格式控制串:包含两种信息。
格式说明:%[修饰符]格式字符,用于指定输出格式。
普通字符:原样输出。