C Primer 编程练习

2.1

#include<stdio.h>
int main(void)
{
    printf("Co Khime ");
    printf("Co Khime ");
    printf("Co ");
    printf("Khime");
    return 0;
}

2.2

#include<stdio.h>
int main(void)
{
    printf("Co Khime ");
    printf("YiLaiAn");
    return 0;
}

2.3

#include<stdio.h>
int main(void)
{
    int y;
    y = 25;
    printf("Khiem is %d year old and she has live %d days", y, 365 * y);
}

2.4

#include<stdio.h>
void jolly(void);
void deny(void);
int main(void)
{
    jolly();
    jolly();
    jolly();
    deny();
}
void jolly(void)
{
    printf("For he's a jolly good fellow! ");
}
void deny(void)
{
    printf("Which nobody can deny!");
}

2.5

#include<stdio.h>
void br(void);
void ic(void);
int main(void)
{
    br();
    printf(",");
    ic();
    printf(" ");
    ic();
    printf(", ");
    br();
    
}
void br(void)
{
    printf("Brazil, Russia");
}
void ic(void)
{
    printf("India China");
}

2.6

#include<stdio.h>
int main(void)
{
    int toes;
    toes = 10;
    printf("toes is %d , Double toes is %d and Quare toes is %d", toes, 2 * toes, toes * toes);
    return 0;
}

2.7

 #include<stdio.h>
void sme(void);

int main(void)
{
    sme();
    sme();
    sme();
    printf(" ");
    sme();
    sme();
    printf(" ");
    sme();
}
void sme(void)
{
    printf("Smile!");
}

-------------------------------------------------------------------------------------------------------------------------------------------------

3.1

 3.2

#include<stdio.h>

int main(void)
{
    int number;
    printf("plaease enter the number of char ");
    scanf("%d",&number);
    printf("the char of the number is %c",number);
    return 0;
}

原文地址:https://www.cnblogs.com/Khime/p/11622560.html