当前位置:网站首页>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.]所创,转载请带上原文链接,感谢
边栏推荐
- CCR coin robot: novel coronavirus pneumonia has accelerated the interest of regulators in CBDC.
- 刷题到底有什么用?你这么刷题还真没用
- 走进C# abstract,了解抽象类与接口的异同
- C + + STL container
- 自定义注解!绝对是程序员装逼的利器!!
- 用例子理解递归
- 【CCPC】2020CCPC长春 F - Strange Memory | 树上启发式合并(dsu on a tree)、主席树
- 坚持追查7年,近10亿美元比特币终被美国政府没收充公
- MultiBank Group宣布创纪录的财务业绩,2020年前三季度毛利达到9,400万美元
- SEO界,值得收藏的10条金玉良言有哪些?
猜你喜欢

浅谈字节最新开源联邦机器学习平台Fedlearner

Getiservicemanager () source code analysis

What can I do if I can't register didi? How to deal with it?

B. protocal has 7000eth assets in one week!

selenium webdriver使用click一直失效问题的几种解决方法

The unscrupulous merchants increase the price of mate40, and Xiaomi is expected to capture more market in the high-end mobile phone market

CSDN bug9: to be added

getIServiceManager() 源码分析

Leetcode 1-sum of two numbers

工厂方法模式
随机推荐
Factory approach model
CSDN bug5: to be added
LeetCode:数组(一)
【goang】sync.WaitGroup详解
[论文阅读笔记] RoSANE, Robust and scalable attributed network embedding for sparse networks
Farfetch、阿里巴巴集团和历峰集团结成全球合作伙伴关系,将加速奢侈品行业数字化进程
网络安全工程师演示:原来***是这样控制你的服务器的!(下)
express -- 学习笔记(慕课)
selenium webdriver使用click一直失效问题的几种解决方法
Commodity management - merge purchase demand into purchase order
OSChina 周二乱弹 —— 我养的绿植分别为土豆,生姜,蒜
中小企业为什么要用CRM系统
Android quick shutdown app
专业之旅——GitHub 热点速览 Vol.45
CSDN bug3: to be added
Taulia推出国际支付条款数据库
使用call、apply和bind解决js中烦人的this,事件绑定时的this和传参问题
csdn bug3:待加
奸商加价销售mate40,小米可望在高端手机市场夺取更多市场
Graph undirected graph