Practice brings true knowledge, let’s brush up on the questions

KiKi wants to know the parity of an integer, please help him determine it. Enter any integer from the keyboard (range - 231~231 - 1), and program to determine its parity.
Input description:
Multiple sets of input, each line of input includes an integer.
Output description:
For each line of input, output whether the number is odd (Odd) or even (Even).


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
	int a = 0;
	while (scanf("%d", &a) != EOF)
	{
		if (a % 2 == 0)
		{
			printf("Even\n");
		}
		else
		{
			printf("Odd");
		}
	}
}

Description
KiKi started to learn the English alphabet. Teacher BoBo told him that there are five letters A(a), E(e), I(i), O(o), U(u) is called a vowel, and all other letters are called consonants. Please help him write a program to determine whether the entered letter is a vowel (Vowel) or a consonant (Consonant).
Input description:
Multiple sets of input, enter one letter per line.
Output description:
For each set of input, the output is one line. If the input letter is a vowel (including upper and lower case), output "Vowel", if the input letter is If it is a non-vowel, output "Consonant".
 

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
    char ch = 0;
    while (scanf("%c", &ch) != EOF)
    {
        if (ch == '\n')
            continue;
        if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'O' || ch == 'o' || ch == 'i' || ch == 'I' || ch == 'U' || ch == 'u')
            printf("Vowel\n");
        else
            printf("Consonant\n");
    }

    return 0;
}

Description
Niu Niu inputs the integer x and the left and right boundaries l and r from the keyboard, a total of three integers. Please judge whether x is between l and r (that is, whether l≤x≤r exists)
Enter description:
Enter x, l, r three in sequence an integer. Separate with spaces.
Output description:
If l≤x≤r exists, then output true, otherwise output false.

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
    int x = 0;
    int l = 0;
    int r = 0;
    scanf("%d %d %d", &x, &l, &r);
    if (l <= x && x <= r)
        printf("true");
    else
        printf("false");
    return 0;
}

Guess you like

Origin blog.csdn.net/2302_79491024/article/details/133834836