1.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
int x, y;
printf("Please enter x :");
scanf("%d", &x);//输入x值
if (x < 5)
y = x;
else if (x >= 5 && x < 15)
y = x + 6;
else
y = x - 6;
printf("y = % d\n", y);
return 0;
}
2.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
char x; //定义x
scanf("%c", &x); //输入x
if (x >= 97)
printf("%c", x - 32); //若为小写,转换为大写输出
else
printf("%c", x); //若为大写,直接输出
return 0;
}
3.
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define n 3
int main()
{
int i, j, a[n][n], sum = 0;