当前位置:网站首页>Daily practice of C language - day 80: currency change
Daily practice of C language - day 80: currency change
2022-07-01 09:01:00 【Xiaohui_ Super】
C Practice your language every day
2022 year 2 month 13 Japan
List of articles
Title Description
take 5 RMB yuan into 1 element 、5 Angular sum 1 Dimes , How many different exchange methods are there .
Problem analysis
list 3 element 1 Sub equation 10x+5y+z=50
All the solutions of
Code implementation
#include <stdio.h>
int main()
{
int one_yuan = 0, five_jiao = 0, one_jiao = 0;
int cnt = 0; // Number of exchange methods
for(one_yuan = 0; one_yuan <= 5; one_yuan++)
for(five_jiao = 0; five_jiao <= 10; five_jiao++)
for(one_jiao = 0; one_jiao <= 50; one_jiao++)
if(one_yuan * 10 + five_jiao * 5 + one_jiao == 50)
{
cnt++;
printf("%2d gold 1 element %2d gold 5 horn %2d gold 1 horn \t ", one_yuan, five_jiao, one_jiao);
if(cnt % 3 == 0)
printf("\n");
}
printf("\n in total %d There are two methods of exchange \n", cnt);
return 0;
}
Running results
边栏推荐
- LogBack
- Promise异步编程
- 又到年中,固定资产管理该何去何从?
- Shell script -read command: read data entered from the keyboard
- What are the differences between the architecture a, R and m of arm V7, and in which fields are they applied?
- Shell script - definition, assignment and deletion of variables
- Do you know how data is stored? (C integer and floating point)
- Public network cluster intercom +gps visual tracking | help the logistics industry with intelligent management and scheduling
- Advanced level of C language pointer (Part 1)
- Principle and application of single chip microcomputer timer, serial communication and interrupt system
猜你喜欢
小鸟识别APP
大型工厂设备管理痛点和解决方案
What are the differences between the architecture a, R and m of arm V7, and in which fields are they applied?
Nacos - 服务发现
Why is the Ltd independent station a Web3.0 website!
Glitch free clock switching technology
Memory size end
Advanced level of C language pointer (Part 1)
5mo3 UHI HII HII 17mn4 19Mn6 executive standard
What is the material of 16mo3 steel plate? What is the difference between 16mo3 and Q345R?
随机推荐
Mysql8.0 learning record 17 -create table
Phishing identification app
Shell脚本-echo命令 转义符
Redis source code learning (29), compressed list learning, ziplist C (II)
TV size and viewing distance
中小企业固定资产管理办法哪种好?
Shell script case in statement
It is designed with high bandwidth, which is almost processed into an open circuit?
序列化、监听、自定义注解
Shell script -read command: read data entered from the keyboard
Screenshot tips
ARM v7的体系结构A、R、M区别,分别应用在什么领域?
Shell脚本-变量的定义、赋值和删除
Introduction to 18mnmo4-5 steel plate executive standard and delivery status of 18mnmo4-5 steel plate, European standard steel plate 18mnmo4-5 fixed rolling
LogBack
Centos7 shell script one click installation of JDK, Mongo, Kafka, FTP, PostgreSQL, PostGIS, pgrouting
Nacos - gestion de la configuration
Promise asynchronous programming
Log4j 日志框架
The meaning of yolov5 training visualization index