摘要:
ylbtech-Arithmetic:Console-算法-一个偶数总能表示为两个素数之和1.A,Demo(案例)【程序84】题目:一个偶数总能表示为两个素数之和。1.程序分析:1.B,Solution(解决方案)【不太理解】using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b, c, d; a = Convert.ToInt32(Console.ReadLin... 阅读全文
摘要:
ylbtech-Arithmetic:Console-算法-求0—7所能组成的奇数个数1.A,Demo(案例)【程序83】题目:求0—7所能组成的奇数个数。1.程序分析:1.B,Solution(解决方案) 【不是明白是如何构思的】using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { long sum = 4, s = 4; int j; for (j = ... 阅读全文
摘要:
ylbtech-Arithmetic:Console-算法-809*??=800*??+9*??+11.A,Demo(案例)【程序81】题目:809*??=800*??+9*??+1 其中??代表的两位数,8*??的结果为两位数,9*??的结果为3位数。求??代表的两位数,及809*??后的结果。1.程序分析:1.B,Solution(解决方案)1.B.1,C语言output(long b,long i){ printf("\n%ld/%ld=809*%ld+%ld",b,i,i,b%i);}main(){long int a,b,i;a=809;for(i=10;i< 阅读全文
摘要:
ylbtech-Arithmetic:Console-算法[for,if]-编写一个函数,输入n为偶数时,调用函数求1/2+1/4+...+1/n,1.A,Demo(案例)【程序76】题目:编写一个函数,输入n为偶数时,调用函数求1/2+1/4+...+1/n,当输入n为奇数时,调用函数 1/1+1/3+...+1/n(【利用指针函数】)1.程序分析:1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static float OuShu(int n) ... 阅读全文
摘要:
ylbtech-Arithmetic:Console-算法[for]-打印出杨辉三角形1.A,Demo(案例)【程序61】题目:打印出杨辉三角形(要求打印出10行如下图) 1.程序分析: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[]... 阅读全文
摘要:
ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位取反~1.A,Demo(案例)【程序55】题目:学习使用按位取反~。 1.程序分析:~0=1; ~1=0;1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b; a = 224; b = ~a; C... 阅读全文
摘要:
ylbtech-Arithmetic:Console-算法[运算符]-取一个整数a从右端开始的4~7位1.A,Demo(案例)【程序54】题目:取一个整数a从右端开始的4~7位。程序分析:可以这样考虑: (1)先使a右移4位。(2)设置一个低4位全为1,其余全为0的数。可用~(~0<<4)(3)将上面二者进行&运算。1.B,Solution(解决方案)1.B.1,C语言main(){unsigned a,b,c,d;scanf("%o",&a);b=a>>4;c=~(~0<<4);d=b&c;printf(&quo 阅读全文
摘要:
ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位异或 ^1.A,Demo(案例)【程序53】题目:学习使用按位异或 ^ 。 1.程序分析:0^0=0; 0^1=1; 1^0=1; 1^1=01.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b; a = 077; b ... 阅读全文
摘要:
ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位或 |1.A,Demo(案例)【程序52】题目:学习使用按位或 | 。1.程序分析:0|0=0; 0|1=1; 1|0=1; 1|1=11.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b; a = 077; b = a |... 阅读全文
摘要:
ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位与 &1.A,Demo(案例)【程序51】题目:学习使用按位与 & 。 1.程序分析:0&0=0; 0&1=0; 1&0=0; 1&1=11.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b; a = 077; b = ... 阅读全文