正在加载图片...
1.编写程序,输入一个字符ch,输出字符的类型,即字母( alpha)、数字( numerIc) 或其他字符( other)。 #indludestdio, h maino char ch ch=getchar; if(dh>=6588ch<=90|ch>=978&dh<=122) printf( \nch=%c ch) printf( nThis is an alpha!) else if(dh>=4888h<=57) printf( \nch=%C, ch); printf( nThis is a numeric else printf( \ nThis is other! " 2.编写程序,输入一个正整数,判断该数是奇数还是偶数,并输出结果。 maIn printf( \nplease input the integer(0): i scanf( %d, &m) printf \nThe integer is %d,m) if(m%2==0) printf \nThis is a even!) else printf( \nThis is a odd 3.有一函数: x< (-1≤x≤1) 3x+5 <x<10 5x+3bg0(2x2-1)-13(x>10) 编写一个程序,用 scanf函数输入x的值,输出y值。注意表达式的书写方法 运行程序,输入ⅹ的值(分别用上述4种情况),检査输出的y值是否正确1. 编写程序,输入一个字符 ch,输出字符的类型,即字母(alpha)、数字(numeric) 或其他字符(other)。 #include “stdio.h” main() { char ch; ch=getchar(); if(ch>=65&&ch<=90||ch>=97&&ch<=122) { printf(“\nch=%c”,ch); printf(“\nThis is an alpha!”); } else if(ch>=48&&ch<=57) { printf(“\nch=%c”,ch); printf(“\nThis is a numeric!”); } else printf(“\nThis is other!”); } 2. 编写程序,输入一个正整数,判断该数是奇数还是偶数,并输出结果。 main() { int m; printf(“\nPlease input the integer(>0):”); scanf(“%d”,&m); printf(“\nThe integer is %d”,m); if(m%2==0) printf(“\nThis is a even!”); else printf(“\nThis is a odd!”); } 3. 有一函数:        + − − + − + − = 5 3log (2 1) 13 3 5 1 1 2 10 2 3 x x x x x y ( ) ( ) ( ) ( 10) 1 10 1 1 1    −    − x x x x 编写一个程序,用 scanf 函数输入 x 的值,输出 y 值。注意表达式的书写方法。 运行程序,输入 x 的值(分别用上述 4 种情况),检查输出的 y 值是否正确
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有