c语言 求解 急!!

来源:百度知道 编辑:UC知道 时间:2024/05/30 04:05:50
先输入两个数X,Y;再输出Z=Y-X;
再输入一个数Q,输出P=Q-Z;
再输入一个数N,输出M=N-P;
就这样一直下去..如果输入的数为0;则程序结束;
谢谢..帮忙做个程序吧..谢谢

#include"stdio.h"
void main()
{float x,y;
printf("please input x!\n");
scanf("%f",&x);
printf("please input y!\n");
scanf("%f",&y);
while(y)
{x=y-x;
printf("%f\n",x);
printf("please input a number!\n");
scanf("%f",&y);
}
}

int strlen(char *s){ int n=0; while(*s!='\0') { s++; n=n+1; } return n; } void cov(char *s){ while(*s!='\0') { *s=*s-32; printf("%c",*s); s++; } } main(){ char code[]="abcde"; char *p; int a; p=&code[0]; a=strlen(p); printf("%d\n",a); cov(p) ; getch(); } 这个程序可以实现你要求功能