当前位置:网站首页>Chapter 1: find the algebraic sum of odd factors, find the same decimal sum s (D, n), simplify the same code decimal sum s (D, n), expand the same code decimal sum s (D, n)
Chapter 1: find the algebraic sum of odd factors, find the same decimal sum s (D, n), simplify the same code decimal sum s (D, n), expand the same code decimal sum s (D, n)
2022-07-03 19:26:00 【Shares_ four】
// Find the algebraic sum of odd factors
int main()
{
int d, m, n;
long s;
printf(" please enter an integer n:");
scanf("%d",&n);
s = 0;
for(m = 1; m <= n; m++)
{
if(m % 2 > 0) s = s + m;
else
{
d = m;
while(d % 2 == 0) d = d / 2;
s = s - d;
}
}
printf(" s(%d) = %ld\n", n, s);
return 0;
}
The results verify that :
// Do you agree? Decimal sum s(d, n)
int main()
{
int d, j, n;
double t, s;
printf(" please enter an integer d, n:");
scanf("%d, %d", &d, &n);
t = s = 0;
for (j = 1; j < n; j++)
{
t = t / 10 + (double)d / 10;
s += t;
}
printf(" S(%d, %d) = %.8f\n", d, n, s);
return 0;
}
The results verify that :
// Simplified decimal sum of the same code s(d, n)
int main()
{
int d, n;
double s;
printf(" please enter an integer d, n");
scanf("%d,%d", &d, &n);
s = (n - 0.111111111) * d / 9;
printf(" s(%d, %d) = %.8f\n", d, n, s);
return 0;
}
The results verify that :
// Expand the decimal sum of the same code s(d, n)
int main()
{
int a, b, d, j, n;
double t, s;
printf(" please enter an integer d, n; ");
scanf("%d, %d", &d, &n);
a = d;
b = 1;
while (a > 0)
{
b = b * 10;
a = a / 10;
}
t = s = 0;
for (j = 1; j <= n; j++)
{
t = t / b + (double)d / b;
s += t;
}
printf(" s(%d, %d) = %.8f\n", d, n, s);
return 0;
}
result :
边栏推荐
- 第二章:4位卡普雷卡数,搜索偶数位卡普雷卡数,搜索n位2段和平方数,m位不含0的巧妙平方数,指定数字组成没有重复数字的7位平方数,求指定区间内的勾股数组,求指定区间内的倒立勾股数组
- 第一章:求同吗小数和s(d, n)
- 第一章:递归求n的阶乘n!
- Merge K ascending linked lists
- Today I am filled with emotion
- 我們做了一個智能零售結算平臺
- [new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
- 【光学】基于matlab介电常数计算【含Matlab源码 1926期】
- 第一章: 舍罕王失算
- math_泰勒公式
猜你喜欢
Think of new ways
PR 2021 quick start tutorial, material import and management
[optics] dielectric constant calculation based on MATLAB [including Matlab source code 1926]
[academic related] how to find the innovation of top papers? Chinese universities won the CVPR Best Student Thesis Award for the first time
01. Preparation for automated office (free guidance, only three steps)
第一章:求所有阶乘和数,大奖赛现场统分程序设计,三位阶乘和数,图形点扫描,递归求n的阶乘n!,求n的阶乘n!,舍罕王失算
[new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
第二章:求长方体数组,指定区间内的完全数,改进指定区间内的完全数
The earliest record
Driveseg: dynamic driving scene segmentation data set
随机推荐
UE source code analysis: uccharactermovementcomponent - rootmotion
第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
TFs and SVN [closed] - TFs vs SVN [closed]
NFT without IPFs and completely on the chain?
第一章: 舍罕王失算
Simple solution of physical backup and restore of Damon database
Chapter 1: seek common? Decimal and S (D, n)
Why should we do feature normalization / standardization?
EGO Planner代码解析bspline_optimizer部分(1)
Flume learning notes
SQL injection for Web Security (1)
How does if ($variable) work? [repeat] - how exactly does if ($variable) work? [duplicate]
第一章:求n的阶乘n!
[wallpaper] (commercially available) 70 wallpaper HD free
01 - QT OpenGL display OpenGL window
Counting from the East and counting from the West will stimulate 100 billion industries. Only storage manufacturers who dare to bite the "hard bone" will have more opportunities
论文阅读 GloDyNE Global Topology Preserving Dynamic Network Embedding
Win10 share you don't have permission
Sentinel source code analysis part II - sentinel dashboard console startup and configuration
2022-06-30 网工进阶(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】