ImageVerifierCode 换一换
格式:DOCX , 页数:18 ,大小:242.97KB ,
资源ID:17909373      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/17909373.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(c经典10题文档格式.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

c经典10题文档格式.docx

1、 display=t1+t2; t1=t2; t2=display; +count;%d+,display); return 0;结果输出: 10 0+1+1+2+3+5+8+13+21+34+也可以使用下面的源代码:/* Displaying Fibonacci series up to certain number entered by user. */ int t1=0, t2=1, display=0, num;Enter an integer:num); while(displaynum) 200 0+1+1+2+3+5+8+13+21+34+55+89+144+2、回文检查源代码:

2、/* C program to check whether a number is palindrome or not */ int n, reverse=0, rem,temp;, & temp=n; while(temp!=0) rem=temp%10; reverse=reverse*10+rem; temp/=10; /* Checking if number entered by user and its reverse number is equal. */ if(reverse=n) %d is a palindrome.,n); else%d is not a palindro

3、me. 1232112321 is a palindrome.3、质数检查注:1既不是质数也不是合数。/* C program to check whether a number is prime or not. */ int n, i, flag=0;Enter a positive integer: for(i=2;i=n/2;+i) if(n%i=0) flag=1; break; if (flag=0)%d is a prime number.%d is not a prime number. 2929 is a prime number.4、打印金字塔和三角形使用*建立三角形* *

4、* * * * * * * * * int i,j,rows;Enter the number of rows:rows); for(i=1;=rows; for(j=1;j=1;-i)用 * 打印金字塔 * * * * * * * * * * * * * * * * * * * * * * * * int i,space,rows,k=0; for(space=1;space=rows-i;+space) while(k!=2*i-1) +k; k=0;用 * 打印倒金字塔#include int rows,i,j,space;Enter number of rows: for(space=

5、0;rows-i; for(j=i;=2*i-1; for(j=0;i-1;5、简单的加减乘除计算器/* Source code to create a simple calculator for addition, subtraction, multiplication and division using switch.case statement in C programming. */# include char o; float num1,num2;Enter operator either + or - or * or divide :%co);Enter two operands

6、:%f%fnum1,&num2); switch(o) case +:%.1f + %.1f = %.1f,num1, num2, num1+num2);-%.1f - %.1f = %.1f,num1, num2, num1-num2);*%.1f * %.1f = %.1f,num1, num2, num1*num2);/%.1f / %.1f = %.1f,num1, num2, num1/num2); default: /* If operator is other than +, -, * or /, error message is shown */Error! operator

7、is not correct - 3.48.43.4 - 8.4 = -5.06、检查一个数能不能表示成两个质数之和int prime(int n); iint binary_decimal(int n);int decimal_binary(int n); int n;Instructions:1. Enter alphabet d to convert binary to decimal.n2. Enter alphabet b to convert decimal to binary.n if (c = | c = DEnter a binary number:%d in binary

8、= %d in decimal, n, binary_decimal(n);BEnter a decimal number:%d in decimal = %d in binary, n, decimal_binary(n);int decimal_binary(int n) /* Function to convert decimal to binary.*/ int rem, i=1, binary=0; while (n! rem=n%2; n/=2; binary+=rem*i; i*=10; return binary;int binary_decimal(int n) /* Fun

9、ction to convert binary to decimal.*/ int decimal=0, i=0, rem; rem = n%10; n/=10; decimal += rem*pow(2,i); +i; return decimal;9、使用多维数组实现两个矩阵的相加int main() int r,c,a100100,b100100,sum100100,i,j;Enter number of rows (between 1 and 100):r);Enter number of columns (between 1 and 100):nEnter elements of 1

10、st matrix:/* Storing elements of first matrix entered by user. */ for(i=0;r;c;Enter element a%d%d:,i+1,j+1);aij);/* Storing elements of second matrix entered by user. */Enter elements of 2nd matrix:bij);/*Adding Two matrices */ sumij=aij+bij;/* Displaying the resultant sum matrix. */nSum of two matr

11、ix is: nn,sumij); if(j=c-1)nn10、矩阵转置 int a1010, trans1010, r, c, i, j;Enter rows and column of matrix:%d %dr, &/* Storing element of matrix entered by user in array a. */nEnter elements of matrix: j +j)Enter elements a%d%d:/* Displaying the matrix a */nEntered Matrix: n,aij);/* Finding transpose of matrix a and storing it in array trans. */ transji=aij;/* Displaying the transpose,i.e, Displaying array trans. */nTranspose of Matrix:,transij); if(j=r-1)

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1