当前位置:网站首页>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.]所创,转载请带上原文链接,感谢
边栏推荐
- Enter C abstract to understand the similarities and differences between abstract classes and interfaces
- 带劲!饿了么软件测试python自动化岗位核心面试题出炉,你全程下来会几个?
- File初相识
- mac终端Iterm2支持rz和sz的解决方案
- OSChina 周二乱弹 —— 我养的绿植分别为土豆,生姜,蒜
- 如何看待阿里云成立新零售事业部?
- Hystrix 如何解决 ThreadLocal 信息丢失
- leetcode1-两数之和
- 【技术教程】Visual Studio 2017自建WebRTC中peerconnection_client程序报LNK2019 无法解析的外部符号错误
- Getiservicemanager () source code analysis
猜你喜欢
Hong Kong listed companies transfer cards to acquire 42.5% equity of chuangxinzhong and plan to speed up the distribution of marketing services
区块链论文集【三十一】
Graph undirected graph
ServiceManagerProxy中mRemote变量指的什么?
python pip命令的使用
[paper reading notes] network embedding with attribute refinement
[论文阅读笔记] Network Embedding with Attribute Refinement
《Python Cookbook 3rd》笔记(2.4):字符串匹配和搜索
设计 API 时通过 POST 获取数据需要注意哪些问题
仅发送options请求,没有发送post解决方案
随机推荐
I have a crossed translation tool in my hand!
iOS14新特性-WidgetKit开发与实践
[elixir! 0073] beam built-in memory database ETS
网络安全工程师演示:原来***是这样控制你的服务器的!(下)
Multibank group announced record financial results with gross profit of $94 million in the first three quarters of 2020
JMeter interface test -- a solution with token
CSDN bug8: to be added
不用懂代码,会打字就可以建站?1111 元礼包帮你一站配齐!
Key layout of the Central Government: in the next five years, self-reliance and self-improvement of science and technology will be the priority, and these industries will be named
Filezilla server配置FTP服务器中的各种问题与解决方法
CSDN BUG1: to be added
[论文阅读笔记] Community-oriented attributed network embedding
商品管统——采购需求合并到采购单
The high pass snapdragon 875 has won the title of Android processor, but the external 5g baseband has become its disadvantage
【技术教程】C#控制台调用FFMPEG推MP4视频文件至流媒体开源服务平台EasyDarwin过程
我手撸了一个划线翻译工具!
[paper reading notes] network embedding with attribute refinement
刷题到底有什么用?你这么刷题还真没用
Wu Enda's refining notes on machine learning 4: basis of neural network - Zhihu
CSDN bug11: to be added