D. ADD
Write a program to input an integer n, and to output sum of 1,2,…,n.
输入格式
input an integer n.
输出格式
output sum of 1,2,…,n.
#include<stdio.h>
int main()
{
long long input, sum = 0;
scanf("%lld", &input);
for(int i = 1; i <= input; i++)
sum += i;
printf("%lld", sum);
return 0;
}
E. A+B Problem
Given (a, b), output (a + b).
#include<stdio.h>
int main()
{
long long data1, data2;
scanf("%lld %lld", &data1, &data2);
printf("%lld", data1 + data2);
return 0;
}
F. square root
Write a program to input an integer n, and to output square root of n with format %f.
#include<stdio.h>
#include<math.h>
int main()
{
long long input;
scanf("%lld", &input);
printf("%.6lf", sqrt(input));
return 0;
}