convert.c
上传用户:bjtelijie
上传日期:2010-01-01
资源大小:87k
文件大小:1k
- # include <stdlib.h>
- # include <stdio.h>
- int main()
- {
- char num1[80], num2[80];
- double sum1;
- int sum2;
- long sum3;
- printf("Enter first: ");
- gets(num1);
- printf("Enter second: ");
- gets(num2);
- sum1 = atof(num1)+atof(num2);
- printf("The sum is: %fn", sum1);
- printf("Enter three: ");
- gets(num1);
- printf("Enter four: ");
- gets(num2);
- sum2 = atoi(num1)+atoi(num2);
- printf("The sum is: %dn", sum2);
- printf("Enter five: ");
- gets(num1);
- printf("Enter six: ");
- gets(num2);
- sum3 = atol(num1)+atol(num2);
- printf("The sum is: %ldn", sum3);
- return 0;
- }