// 有一函数:x < 0 ,y = -1;x = 0,y = 0;x > 0,y = 1,编程输入一个x值,要求输出对应的y #include <stdio.h> int main() { int x,y; printf("请输入x:"); scanf("%d",&x); if(x > 0) y = 1; else if(x < 0) y = -1; else y = 0; printf("对应的y值是:%d\n",y); return 0; } <img src="http://img.blog.csdn.net/20150423122047958?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3lhcWlhbjU1Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /> <img src="http://img.blog.csdn.net/20150423122053044?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3lhcWlhbjU1Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /> <img src="http://img.blog.csdn.net/20150423122057927?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3lhcWlhbjU1Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
时间: 2024-10-12 16:45:24