当前位置:网站首页>C language example - print calendar
C language example - print calendar
2022-08-05 11:54:00 【Blue_lan18】
Write a program to display a single-month calendar.The user specifies the number of days in the month and the day of the week that the month starts.
# include int main(){int day;int i, j;int week;printf("Enter number of days in month: ");scanf("%d", &day);printf("Enter starting day of the week (1 = Sun, 7 = Sat): ");scanf("%d", &week);for(j = 1; j < week; j++){printf(" ");}//Type the space before the start of the calendar, a space is 4 bytesfor(i = 1; i <= day; i++){printf("%4d", i);if( (i + week -1) % 7 == 0){printf("\n");}// change line every 7 days}printf("\n");return 0;} 
边栏推荐
- 什么是缓冲区(buffer),什么是缓存(cache)
- 花的含义
- 解决 json.dump 报错:TypeError - Object of type xxx is not JSON serializable
- [7.29-8.5] Review of wonderful technical blog posts in the writing community
- Web3 中的安全问题和防范
- Go compilation principle series 9 (function inlining)
- 2022.08.01_每日一题
- A woman is the most beautiful life in the world
- knife4j
- 【7.29-8.5】写作社区精彩技术博文回顾
猜你喜欢

尚硅谷-JVM-内存和垃圾回收篇(P1~P203)

【硬件架构的艺术】学习笔记(2)同步和复位

有多一只“手”的机器狗出没?就在昇腾AI开发者创享日·南京站

Security Issues and Prevention in Web3

Gao Zelong attended the Boao Global Tourism Ecology Conference to talk about Metaverse and Future Network Technology

C language classic examples - find the largest number in a series of numbers

163_Tricks_Power BI one-click batch creation of custom field parameters
尚硅谷-JVM-性能监控与调优篇(P302~P381)
Byte Qiu Zhao confused me on both sides, and asked me under what circumstances would the SYN message be discarded?

冬日里,28℃的爱情
随机推荐
2022.08.02_每日一题
SonarQube即将亮相第十八届GOPS全球运维大会
尚硅谷-JVM-内存和垃圾回收篇(P1~P203)
【7.29-8.5】写作社区精彩技术博文回顾
【硬件架构的艺术】学习笔记(2)同步和复位
623. Add a row to a binary tree: Simple binary tree traversal problems
Gao Zelong attended the Boao Global Tourism Ecology Conference to talk about Metaverse and Future Network Technology
动手学深度学习_GoogLeNet / Inceptionv1v2v3v4
使用Netty编写通用redis客户端(可指定服务器地址与端口号连接任意redis)
IPMP、PMP、CPMP三个证书该如何选择,有什么区别,哪个对于工作上的
swig 语法介绍
Qt::qcustomplot 和 qchart数据填充相关
Version Control | Longzhi invites you to go to the GOPS Global Operation and Maintenance Conference to explore the road of large-scale, agile, high-quality and open software development and operation
有多一只“手”的机器狗出没?就在昇腾AI开发者创享日·南京站
软件设计七大原则之开闭原则(Open-Closed Principle, OCP)
STM32H743IIT6学习笔记02——USART
2-2.基金的投资交易与结算
163_技巧_Power BI 一键批量建立自定义字段参数
2022.08.03_Daily Question
【硬件架构的艺术】学习笔记(3)处理多个时钟