欢迎来到冰豆网! | 帮助中心 分享价值,成长自我!
冰豆网
全部分类
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • 党团工作>
  • ImageVerifierCode 换一换
    首页 冰豆网 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    c经典10题文档格式.docx

    • 资源ID:17909373       资源大小:242.97KB        全文页数:18页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    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)


    注意事项

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

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2022 冰点文档网站版权所有

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

    收起
    展开