首页    新闻    小组    威客    人才    下载    博客    代码贴    在线编程    论坛
代码贴随便看看全站
/**
 * 【程序2】
 * 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月
 *       后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少?
 * 程序分析:兔子的规律为数列1,1,2,3,5,8,13,21....
 */

#include<stdio.h>

int main() {
    long f1,f2;
    int i;
......................
阅读全部 | xiaowen13 贴于 2022年10月3日 08:24     hide bbsi
/**
 * 【程序4】
 * 题目:用星号绘制余弦曲线和直线。
 */

#include <stdio.h>
#include <math.h>

int main() {
    double y;
    int xc;
    int xx;
......................
阅读全部 | xiaowen13 贴于 2022年10月3日 08:24     hide bbsi
/**
 * 【程序1】
 * 题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
 * 程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去掉不满足条件的排列。
 */

#include<stdio.h>

int main() {
    int i, j, k;
    for (i = 1; i < 5; i++) {   //以下为三重循环
        for (j = 1; j < 5; j++) {
......................
阅读全部 | xiaowen13 贴于 2022年10月3日 08:23     hide bbsi
#include <stdio.h>

int main() {
printf("我在重庆为龚小雪举大旗\n");

// 练习一下循环的使用
int i;
for (i=1.0; i<=52.0; i++) {
printf("我爱你龚小雪 %d 次\n", i);
}

printf("\n\n画一个爱你的心:");
......................
阅读全部 | okyn 贴于 2022年10月1日 17:53     hide bbsi
#include <stdio.h>

// //2. 将输入的a和b两个整数,比较后打印出较大值和较小值。

void checkBigger(double a, double b){
    double bigger,smaller;
    if (a<b){
        bigger = b;
        smaller = a;
    }
    else{
        bigger = a;
......................
阅读全部 | tyotw53 贴于 2022年9月30日 15:02     hide bbsi
#include <stdio.h>

// 输入两个浮点数,计算三角形面积
double areaOfTriangle(double a, double b){
    printf("the area is:%lf\n", a * b / 2);
}

int main(){
    areaOfTriangle(1.2, 2.3);
    return 0;
}
阅读全部 | tyotw53 贴于 2022年9月30日 14:44     hide bbsi
//学习java第一天,输出helloworld
public class HelloWorld{
    public static void main(String[] args){
        System.out.println("HelloWorld");
    }
}
阅读全部 | glitterkbl 贴于 2022年9月29日 23:45     hide bbsi
#include&it;stdio.h&gd;
int main(){
    int i;
for(i=1;i<=9;i++){
int t;
for(t=1;t<=i;t++){
printf("%d*%d=%2d",i,j,
}
printf("\n");
}
return 0;
    }
阅读全部 | XaioKai 贴于 2022年9月29日 18:44     hide bbsi
#include&it;stdio.h&gd;
int main
{int i;
for(i=1;i<=9;i++)
int t;
for(t=1;t<=i;t++)
printf("%d*%d=%2d,i,j,printf("\n")
return 0;}
阅读全部 | XaioKai 贴于 2022年9月29日 18:38     hide bbsi
import java.util.Scanner;
public class PrintGrade{
    public static void main(String[] args){
        Scanner input  = new Scanner(System.in);
       int sc;
       System.out.println("please enter your score:");
       sc = input.nextInt();
       
       while (sc!=999){ //不固定次数循环(先调用方法后)
           printGrade3(sc);
           System.out.println("please enter your score:");
           sc = input.nextInt();
......................
阅读全部 | cookiie 贴于 2022年9月27日 11:58     hide bbsi
上一页 27 28 29 30 31 32 33 34 35 36 下一页