功能:判断一个整数w的各位数字平方之和能否被5整除,可

功能:判断一个整数w的各位数字平方之和能否被5整除,可以被5整除则返回1,否则返回0。

#include<stdio.h>
#include<conio.h>
int fun(int w)
{
    int k,s=0;
    do {
        _____1_____
        _____2_____
    }
    while(_____3_____)
        if(_____4_____)
            _____5_____
        else_____6_____
    return k;
}
void main()
{
    int m;
    void TestFunc();
    printf("Enter m: ");
    scanf("%d", &m);
    printf("\nThe result is %d\n", fun(m));
    TestFunc();
}
void TestFunc()
{
    FILE *IN,*OUT;
    int c ;
    int t;
    int o;
    IN=fopen("in.dat","r");
    if(IN==NULL)
    {
        printf("Read File Error");
    }
    OUT=fopen("out.dat","w");
    if(OUT==NULL)
    {
        printf("Write File Error");
    }
    for(c=1;c<=5;c++)
    {
        fscanf(IN,"%d",&t);
        o=fun(t);
        fprintf(OUT,"%d\n",o);
    }
    fclose(IN);
    fclose(OUT);
}
答案
第1空:s=s+(w%10)*(w%10);
第2空:w=w/10;
第3空:w!=0
第4空:s%5==0
第5空:k=1;
第6空:k=0;

题目信息

题号:6791
题型:填空题
难度:普通