给定两个正数,求他们的正差值并输出
2015-02-25 13:03
417 查看
/*
Input two numbers and output the difference of them
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num1,num2;
printf("Please input two numbers use a space to seperate them.\n");
scanf("%d %d",&num1,&num2);
{
int diff=abs(num1-num2);
printf("The difference of %d and %d is %d\n",num1,num2,diff);
}
return 0;
}
result:
Input two numbers and output the difference of them
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num1,num2;
printf("Please input two numbers use a space to seperate them.\n");
scanf("%d %d",&num1,&num2);
{
int diff=abs(num1-num2);
printf("The difference of %d and %d is %d\n",num1,num2,diff);
}
return 0;
}
result:
相关文章推荐
- 第七周上机任务1---给定两个正数,求出两数的正差值并输出
- 第七讲作业,给定两个正整数,求出两数的正差值并输出
- 输入两个很大的正数(用C字符串表示),输出他们的乘积,将设不考虑非法输入。
- 给定两个正整数,求出两数的正差值并输出
- 给定两个正整数,求出两数的正差值并输出
- 第五周-raptor 给定两个正整数 输出正差值
- 给定两个正整数,求出两数的正差值并输出。
- 给定两个正整数,求出两数的正差值并输出
- 第七周上机实践项目——给定两个正整数,求出两数的正差值并输出
- 汇编最后一次实验(给定两个数组,以十六进制的方式输出其中的最大值)
- C编程--输入两个数,输出他们的最大公约数
- 简单编程(三)编写一个程序,要求用户输入两个整数,然后计算并输出他们的和、差、积、商。
- 【Java实现】给出两个整型数组,将他们合并后从小到大排序并输出
- 和为n连续正数序列 & 排序数组中和为给定值的两个数字
- 输入一个递增排序的数组和一个数字S,在数组中查找两个数,是的他们的和正好是S,如果有多对数字的和等于S,输出两个数的乘积最小的。
- 输出有序数组的中两个元素差值为指定值diff的两个元素
- 面试题 输入两个很大的正数(用C字符串表示),输出它们的乘积,不考虑非法输入
- 两个数组,交互他们之间的数据,使得他们之间的差值最小
- @陈利人 : #面试题#给定两个数组X和Y,元素都是正数。请找出满足如下条件的数对的数目: x^y > y^x,即x的y次方>y的x次方;x来自X数组,y来自Y数组
- 输入一个递增排序的数组和一个数字S,在数组中查找两个数,是的他们的和正好是S,如果有多对数字的和等于S,输出两个数的乘积最小的。