- 博客(5)
- 收藏
- 关注
原创 C语言用冒泡排序法对十个整数排序,十个整数用scanf()函数输入
#include<stdio.h>void main(){ int i,j,a[10],t; for (i=0;i<10;i++) { scanf("%d",&a[i]); } for(j=0;j<10-i;j++) { if(a[j]>a[j+1]) { t=a[j+1]; ...
2022-05-23 17:39:35 3141 3
原创 C语言求解一元二次方程代码
#include<stdio.h>#include<math.h>void main(){double a,b,c,s,d,e,f,x1,x2;printf("请输入a,b,c的值:\n");scanf("%lf,%lf,%lf",&a,&b,&c);s=(a+b+c)/2;d=pow(b,2)-4*a*c;e=sqrt(d)/2*a;f=b/-2*a;if (d>0){ x1=f+e; x2=f-e; ...
2022-05-18 17:53:21 1223
原创 C语言判断一句话中有几个英语单词
#include<stdio.h>void main(){ char string[99]; int i,num=0,word=0; char c; gets(string); for(i=0;(c=string[i])!='\0';i++) if(c==' ') word=0; else if(word==0) { word=1; ...
2022-05-18 17:49:21 1285
原创 找出3000年以内的闰年代码
#include<stdio.h>void main(){ int year; printf("请找出3000年以内的闰年:\n"); for(year=1;year<=3000;year++) { if((( year%4==0)&&(year%100!=0))||(year%400==0)) printf("%d年 ",year); }}...
2022-05-18 17:41:12 441
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人