摘要: #include "stdio.h" #define N 50 long fun(char *s) { int i,t; long sum=0; for(i=0;s[i];i++) { if(s[i]>='0'&&s[i]<='9')//当字符是'0'--'9'时,*-‘0'就行了 t=s[i]-' 阅读全文
posted @ 2020-09-20 21:45 然终酒肆 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 1949年的国庆节(10月1日)是星期六。今年(2012)的国庆节是星期一。 那么,从建国到现在,有几次国庆节正好是星期日呢? 1 # include <stdio.h> 2 int yday(int year); 3 int main(void) 4 { 5 int year; 6 int n; 阅读全文
posted @ 2020-09-20 21:10 然终酒肆 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<stdlib.h> #define MAXINE 100 int main(void) { int j,i; int n; int a[MAXINE][MAXINE]; printf("Enter n:"); scanf("%d",&n); a[ 阅读全文
posted @ 2020-09-20 15:58 然终酒肆 阅读(110) 评论(0) 推荐(0) 编辑
摘要: ABCDEFG BABCDEF CBABCDE DCBABCD EDCBABC 这是一个5行7列的图形,请找出这个图形的规律,并输出一个n行m列的图形。 #include<stdio.h> #include<stdlib.h> #define MAXINE 26 void print(char a[ 阅读全文
posted @ 2020-09-20 15:47 然终酒肆 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 对于长度为5位的一个01 串,每一位都可能是0或1,一共有32种可能。它们的前几个是: 00000 00001 00010 00011 00100 请按从小到大的顺序输出这 32种01串。 1 #include<stdio.h> 2 int main(void) 3 { 4 int count=0; 阅读全文
posted @ 2020-09-20 14:40 然终酒肆 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 问题描述 给定圆的半径r,求圆的面积。 输入格式 输入包含一个整数r,表示圆的半径。 输出格式输出一行,包含一个实数,四舍五入保留小数点后7位,表示圆的面积。 样例输入 4 样例输出 50.2654825 1 #include<stdio.h> 2 #define PI 3.141592653589 阅读全文
posted @ 2020-09-20 14:31 然终酒肆 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 是很简单 我也得敲啊 啤酒每罐2.3元,饮料每罐1.9元。小明买了若干啤酒和饮料,一共花了 82.3元。 我们还知道他买的啤酒比饮料的数量少,请你计算他买了几罐啤酒。 注意:答案是一个整数 1 int main(int argc, char** argv) { 2 for(int i=1;i*2.3 阅读全文
posted @ 2020-09-20 14:22 然终酒肆 阅读(186) 评论(0) 推荐(0) 编辑