C Language Programming classic example of nine

Source: Internet
Author: User
Tags printf

Topic: 809*? =800*?? +9*?? +1 of them?? Representative of the two digits, 8*?? The result is two digits, 9*?? The result is a 3-digit number. Please?? Representative of the two digits, and 809*?? After the result.

1. Procedure Analysis:

2. Program Source code:

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<100;i++)
 {
  b=i*a+1;
  if(b>=1000&&b<=10000&&8*i<100&&9*i>=100)
   output(b,i);
 }
}

"Program 82"

Title: Octal Conversion to decimal

1. Procedure Analysis:

2. Program Source code:

main()
{
 char *p,s[6];int n;
 p=s;
 gets(p);
 n=0;
 while(*(p)!='\0')
 {
  n=n*8+*p-'0';
  p++;
 }
 printf("%d",n);
}

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.