learn through suffering C language learn through suffering 
C language

Practice Problem 3

Basics


Question 1-1
What function is used in C to display a string on the screen?


Question 1-2
To use the above function, you must pass the manual to the compiler. State the pseudo-instruction for this purpose and the filename of the manual to be passed.


Question 1-3
To insert a line break when displaying text in the above function, you write the symbol.
What is the general term for that symbol?

Program reading


Question 2-1
#include <stdio.h>

int main(void)
{
    printf("The pen is mightier\n than the sword\n");
    return 0;
    printf("Time is money\n");
}

Program documentation


Question 3-1
Create a program that displays the following on the screen.
Provided that the tops of the second characters are aligned, the number of spaces doesn't matter.

Intel : Pentium4
AMD  : Athlon64

Fundamentals (Answer Key)


Solution 1-1
printf function

While there are other options like puts, printf is the fundamental function.

Solution 1-2
Pseudo Command  #include
FileName stdio.h

It is also correct to use #include .

Solution 1-3
Escape sequence

Program Reading (Solution Example)


Solution 2-1
The pen is mightier
than the sword

Note that the function terminates with a return statement, so the last sentence will not be displayed.

Program Documentation (Example Solution)


Question 3-1
#include <stdio.h>

int main(void)
{
    printf("Intel\t: Pentium4\n");
    printf("AMD\t: Athlon64\n");
    return 0;
}

You don't need to use spaces to align the text, but using tabs is easier.
Please be careful of the line break at the end, as even experienced writers can easily forget it.


About This Site

Learning C language through suffering (Kushi C) is
This is the definitive introduction to the C language.
It systematically explains the basic functions of the C language.
The quality is equal to or higher than commercially available books.


Part 0: Program Overview

  1. What is a program?



Chapter 3: Displaying on the Screen

  1. String Display
  2. newline character
  3. Practice Problem 3

Chapter 4: Displaying and Calculating Numbers

  1. Display of numbers
  2. Basic calculations
  3. Numeric types
  4. Practice Problem 4


Chapter 6: Input from the Keyboard

  1. input function
  2. The fear of input
  3. Practice Problem 6



Chapter 9: Repeating a Fixed Number of Times

  1. Iterative sentence
  2. How Loops Work
  3. Practice Problem 9

Chapter 10: Repeating Without Knowing the Number of Times

  1. Unspecified loop
  2. Input validation
  3. Practice Problem 10



Chapter 13: Handling Multiple Variables at Once

  1. Handling multiple variables collectively.
  2. Arrays
  3. Practice Problem 13






Chapter 19: Dynamic Arrays

  1. Create arrays freely.
  2. Practice Problem 19

Loading comment system...