[4-1]

#include<stdio.h>

void main(void)

{

 int score[30]={100,52,43,11,33,95,5,78,65,53,

                    98,18,27,44,65,80,89,20,91,77,

                    14,45,31,70,99,30,70,55,10,28};

 int number[10]={0,0,0,0,0,0,0,0,0,0};

 int i;

 

 for(i = 0 ; i < 30 ; i++){

    if(score[i]<=10) number[0]+=1;

    else if(score[i]<=20) number[1]+=1;

    else if(score[i]<=30) number[2]+=1;

    else if(score[i]<=40) number[3]+=1;

    else if(score[i]<=50) number[4]+=1;

    else if(score[i]<=60) number[5]+=1;

    else if(score[i]<=70) number[6]+=1;

    else if(score[i]<=80) number[7]+=1;

    else if(score[i]<=90) number[8]+=1;

    else number[9]+=1;

 }

 for(i=0;i<10;++i){

    printf("Number of score %2d-%3d: %d\n",10*i+1,10*i+10,number[i]);

 }

}

 

[4-2]

#include<stdio.h>

void main(void)

{

 char name[99];

 int i,j,n_sei=0,n_mei=0;

 

 printf("Enter name (ex. yamaguchi-momoko): ");

 scanf("%s", &name);

 

 for(i=0;i<99;++i){

    if(name[i]=='-') break;

    n_sei++;

 }

 

 for(j=i+1;j<99;++j){

    if(name[j]=='\0') break;

    n_mei++;

 }

 

 printf("Number of letters of family name: %d\n",n_sei);

 printf("Number of letters of first name: %d\n",n_mei);

}