下列给定程序中函数proc的功能是:取出长整型变量s中偶数位上的数,依次构成一个新数放在t中。例如,当s中的数为l23456789时,t中的数为2468。请修改程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: include<stdlib.h> include<stdio.h> include<conio.h> //****found**** void proc(long S,long t) { long sl=10; s/=10; *t=s%10; //****found**** while(s<O) { s=s/l00; *t=s%10*sl+*t; s1=sl*10; } } void main {long S,t; system("CLS"): printf("\nPlease enter S:"); scanf("%ld",&s); proc(S,&t); . printf("The result is:%ld\n",t); }

时间:2023-10-01 11:33:31

相似题目