815 C Language Jobs

Source: Internet
Author: User

/*there is a fractional sequence: 2/1,3/2,5/3,8/5,13/8,21/13. Find the sum of the first 20 items of this series. */#include<stdio.h>intMainvoid){    intn,t,num= -; floatA=2, b=1, s=0;  for(n=1; n<=num;n++) {s=s+a/b; T=A; A=a+b; b=t;/*This part is the key to the program*/} printf ("and for%9.6f\n", s); }
/*Print out all the "daffodils", the so-called "daffodils number" refers to a three-digit number, whose numbers are cubic and equal to the number itself. For example: 153 is a "narcissus number", because the 153=1 three times the square +5 of the three +3-time Square*/#include<stdio.h>intMainvoid){    intNUM,GW,SW,BW; Num=0, gw=0, sw=0, bw=0;  for(num= -; num<=999; num++) {GW=num%Ten; SW=num/Ten%Ten; Bw=num/ -; if(NUM!=GW*GW*GW+SW*SW*SW+BW*BW*BW)Continue; printf ("The number of daffodils are:%d\n", num); }    }

/*give a positive integer with no more than 5 digits, ask: ask for a number of digits and print out the numbers in reverse order*/#include<stdio.h>intMainvoid){    intnum,i,j,x; Num=0, i=0, x=0; printf ("Please enter a positive integer no higher than five bits: \ n"); scanf ("%d",&num);  while(num!=0) {num=num/Ten; I++; } printf ("This number is%d digits \ n", i);  for(j=0; j<i;j++) {num=num/Ten;  for(x=0; x!=0; x + +) {x=num%Ten; } printf ("%d", x); }                                      }

815 C Language Jobs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.