[Introduction to C language] ZZULIOJ 1000-1005

ZZULIOJ 1000: Get into C language from today

topic description

    "C language" is a shining name in programming languages. Everyone who studies computers and related majors will pay attention to it first when learning programming languages. C language is a widely used computer programming language developed at Bell Labs in the early 1970s. It has dominated the entire software industry for decades since its birth, and is known as the king of programming languages. Therefore, most universities at home and abroad will choose C language as the introductory language for learning programming, although it is not the most friendly and easy to learn for beginners.

    Where is the difficulty of C language? The difficulty lies not in grammar, but in computational thinking. The cultivation of thinking requires a lot of programming practice. Therefore, the C language is not for listening and watching, but for hands-on and brain training. Think about the time and money you have spent on cultivating mathematical thinking from childhood to adulthood. In the information age, if you choose an IT-related major, it is worthwhile to put in as much effort to cultivate computational thinking. Come on, boy!

    Please submit a program that outputs a statement: "Start learning C language today". (It means that you have to invest in it from today)

enter

none

output

Output a line of text as it is:

Start learning C language today

sample input

sample output

从今天开始入坑C语言 
#include <stdio.h>#include <stdlib.h> int main(){
   
       printf("从今天开始入坑C语言");    return 0;}

ZZULIOJ 1001:Free+b

topic description

Computes the sum of two integers.

enter

Enter two integers, separated by a space.

output

The output is the sum of two integers on a single line.

sample input

1 1

sample output

2
#include <stdio.h>#include <stdlib.h> int main(){
   
       int a,b;    scanf("%d%d",&a,&b);    printf("%d\n",a + b);    return 0;}

ZZULIOJ 1002: Simple Polynomial Evaluation

topic description

For any integer entered by the user, output the value of the following polynomial.

y=2x^2+x+8

enter

Enter a value for the integer x.

output

Output an integer that is the value of the polynomial.

sample input

1

sample output

11
#include <stdio.h>#include <stdlib.h> int main(){
   
       int  x;    scanf("%d",&x);    printf("%d\n",2*x*x+x+8);    return 0;}

ZZULIOJ 1003: Four Arithmetic Operations on Two Integers

topic description

Input two integers num1 and num2, please design a program to calculate and output their sum, difference, product, integer quotient and remainder.

enter

The input is only two positive integers num1 and num2.

output

The output occupies one line, including the sum, difference, product, quotient and remainder of two numbers, and the data are separated by a space.

sample input

1 2

sample output

3 -1 2 0 1
#include <stdio.h>#include <stdlib.h> int main(){
   
       int   x,y;    scanf("%d%d",&x,&y);    printf("%d %d %d %d %d\n", x+y , x-y , x*y , x/y , x%y );    return 0;}

ZZULIOJ 1004: Digit Separation for Three-Digit Numbers

topic description

Input an arbitrary three-digit positive integer from the keyboard, and find the digits in the ones, tens and hundreds respectively.

enter

Enter any three-digit positive integer.

output

Output the digits of ones, tens, and hundreds in sequence. Separated by spaces, but there is no space after the last data, and the line will be broken directly.

sample input

367

sample output

7 6 3
#include <stdio.h>#include <stdlib.h> int main(){
   
       int m;    scanf ("%d",&m);    printf("%d %d %d\n",m%10,(m/10)%10,(m/100)%10);    return 0;}

ZZULIOJ 1005: integer powers

topic description

Input 3 integers and output their powers of 1, 2 and 3.

enter

Enter 3 integers, separated by spaces.

output

Output 3 lines with 3 integers in each line, which are their 1st power, 2nd power and 3rd power respectively. Each integer occupies 9 columns, and less than 9 columns are left-aligned.

sample input

1 5 100

sample output

1        1        1        
5        25       125      
100      10000    1000000
#include <stdio.h>#include <stdlib.h> int main(){
   
       int   x,y,z;    scanf ("%d%d%d",&x,&y,&z);    printf("%-9d%-9d%-9d\n",x,x*x,x*x*x);    printf("%-9d%-9d%-9d\n",y,y*y,y*y*y);    printf("%-9d%-9d%-9d\n",z,z*z,z*z*z);    return 0;}

Guess you like

Origin blog.csdn.net/m0_62975468/article/details/125717841