//题目:有1、2、3、4个数字,能组成多少个互不相//同且无重复数字的三位数?都是多少?#include<stdio.h>#include<stdlib.h>intmain(){int i, j, k,num,a=0;for(i =1; i <=4; i++){for(j =1; j <=4; j++){for(k =1; k <=4; k++)if(i != j && i != k && j != k){
num = k *100+ j *10+ i;printf("%d\n", num);
a++;}}}printf("共有%d个数:\n", a);system("pause");}
//题目:企业发放的奖金根据利润提成。//利润(I)低于或等于10万元时,奖金可提10%;//利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可提成7.5%;//20万到40万之间时,高于20万元的部分,可提成5%;//40万到60万之间时高于40万元的部分,可提成3%;//60万到100万之间时,高于60万元的部分,可提成1.5%;//高于100万元时,超过100万元的部分按1%提成,//从键盘输入当月利润I,求应发放奖金总数?#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>doublebonus(double num){double x;if(num <=100000)
x = num *0.1;if(num >=100000&& num <=200000)
x =100000*0.1+(num -100000)*0.075;if(num >=200000&& num <=400000)
x =100000*0.1+100000*0.075+(num -200000)*0.05;if(num >=400000&& num <=600000)
x =100000*0.1+100000*0.075+200000*0.05+(num -400000)*0.03;if(num >=600000&& num <=1000000)
x =100000*0.1+100000*0.075+200000*0.05+200000*0.03+(num -600000)*0.015;if(num >=1000000)
x =100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+(num -1000000)*0.01;return x;}intmain(){double a;printf("请输入当月的利润:\n");scanf("%lf",&a);
a =bonus(a);printf("奖金为:%lf\n", a);system("pause");}
//题目:一个整数,它加上100后是一个完全平方数,//再加上168又是一个完全平方数,请问该数是多少?#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<math.h>intmain(){int i,n=0;int a, b;for(i =0; i <10000; i++){
a = i +100;
b = i +268;if(a ==(int)sqrt(a)*(int)sqrt(a)){if(b ==(int)sqrt(b)*(int)sqrt(b)){printf("这个数为:%d\n", i);}}}system("pause");}
//题目:输入某年某月某日,判断这一天是这一年的第几天?//思路及算法:利用循环和判断,得出第多少天//闰年:31天:1,3,5,7,8,10,12 30天:4,6,9,11 29天:2//常年:31天:1,3,5,7,8,10,12 30天:4,6,9,11 28天:2#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<math.h>intday(int a,int b,int c){int num;//1.判断这一年是否为闰年if(a %4==0){
num =(b -1)*30;{if(b ==12)
num = num +6-1;if(b ==10)
num = num +5-1;if(b ==8)
num = num +4-1;if(b ==7)
num = num +3-1;if(b ==5)
num = num +2-1;if(b ==3)
num = num +1-1;if(b ==2)
num = num +1;}
num = num + c;}else{
num =(b -1)*30;{if(b ==12)
num = num +6-2;if(b ==10)
num = num +5-2;if(b ==8)
num = num +4-2;if(b ==7)
num = num +3-2;if(b ==5)
num = num +2-2;if(b ==3)
num = num +1-2;if(b ==2)
num = num +1;}
num = num + c;}return num;}intmain(){//1.让用户输入自己的出生年月日(输入数字+字符)int n, y, d;printf("请输入你的出生年月日:\n");scanf("%d%d%d",&n,&y,&d);//2.将数据代入运算int result =day(n, y, d);//3.打印数字printf("您出生在%d年的第%d天\n", n, result);system("pause");}
//题目:有1、2、3、4个数字,能组成多少个互不相//同且无重复数字的三位数?都是多少?#include<stdio.h>#include<stdlib.h>int main() { int i, j, k,num,a=0; for (i = 1; i <= 4; i++) { for (j = 1; j <= 4; j++) { for...