当前位置:网站首页>2020-11-07
2020-11-07
2020-11-10 10:41:00 【I'm sorry.】
Application C# Language
1. seek π/2 The formula of the approximate value of :
π/2=2/12/34/3*…2n/2n-12n/2n+1, Seeking the right n=1000 when π Approximate value
using System;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
int n;
double pi=1;
for (n = 1; n <= 1000; n++)
{
pi=pi*2*n/(2*n-1)*2*n/(2*n+1);
}
Console.WriteLine(" Output approximate value : " +2*pi);
}
}
}
2. Design a program , Enter a decimal number , Output the corresponding hexadecimal number
using System;
namespace jinzhizhuanhuan
{
class Program
{
private static string result;
static void Main(string[] args)
{
Console.WriteLine(" Please enter decimal number : ");
int m = int.Parse(Console.ReadLine());
String result= Convert.ToString(m, 16);
Console.WriteLine(" The hexadecimal number is : " );
Console.WriteLine(m.ToString("X"));
}
}
}
3. Find the array a The subscript of the maximum value in , Output subscript and maximum
using System;
namespace zuidazhix
{
class Program
{
static void Main(string[] args)
{
int max;
int i;
int j;
int[] her = new int[] {
89, 23, 45, 34, 34, 56, 6, 5, 9, 21 };
max = her[0];
for (i = 1; i < her.Length; i++)
{
if (her[i] > max)
{
max = her[i];
}
}
Console.WriteLine(" The maximum is : " + max);
for (j = 0; j < her.Length; j++)
{
if (her[j] == max) {
Console.WriteLine(" The subscript is : "+j);
}
}
}
}
}
版权声明
本文为[I'm sorry.]所创,转载请带上原文链接,感谢
边栏推荐
- Solution of MAC terminal iterm2 supporting RZ and sz
- 寻找性能更优秀的不可变小字典
- csdn bug7:待加
- CSDN bug11: to be added
- On fedlearner, the latest open source federated machine learning platform of byte
- 计算机专业的学生要怎样做才能避免成为低级的码农?
- 【高级测试工程师】新鲜出炉的三套价值18K的自动化测试面试(网易、字节跳动、美团)
- csdn bug6:待加
- Mongodb index management of distributed document storage database
- 港股上市公司移卡收购创信众42.5%股权 谋划加快营销服务布局
猜你喜欢
csdn bug10:待加
MultiBank Group宣布创纪录的财务业绩,2020年前三季度毛利达到9,400万美元
浅谈字节最新开源联邦机器学习平台Fedlearner
GNU assembly basic mathematical equations multiplication
CentOS7本地源yum配置
[paper reading notes] rosane, robust and scalable attributed network embedding for sparse networks
csdn bug9:待加
Hong Kong listed companies transfer cards to acquire 42.5% equity of chuangxinzhong and plan to speed up the distribution of marketing services
[论文阅读笔记] RoSANE, Robust and scalable attributed network embedding for sparse networks
Hystrix 如何解决 ThreadLocal 信息丢失
随机推荐
LeetCode:数组(一)
网络安全工程师演示:原来***是这样控制你的服务器的!(下)
CentOS7本地源yum配置
一个 Task 不够,又来一个 ValueTask ,真的学懵了!
Connection to XXX could not be established. Broker may not be available
LeetCode 5561. 获取生成数组中的最大值
分布式文档存储数据库之MongoDB索引管理
csdn bug5:待加
csdn bug6:待加
Oschina: my green plants are potatoes, ginger and garlic
ASP.NET Core framework revealed [blog Summary - continuous update]
Factory approach model
刷题到底有什么用?你这么刷题还真没用
layer.prompt(options, yes) - 输入层
CSDN bug8: to be added
ASP.NET Core框架揭秘[博文汇总
使用call、apply和bind解决js中烦人的this,事件绑定时的this和传参问题
gnu汇编语言使用内联汇编 扩展asm
What can I do if I can't register didi? How to deal with it?
C + + STL container