# Category Archives: C language (en)

## C Language: Calculating the Level of Difficulty of a Text Using the Coleman-Liau Index

We continue to take the Computer Science CS50 (Harvard) course, and this time we will do the task of calculating the level of complexity of the text according to the Colman-Liau index (readability.c) in the C programming language. According to … Continue reading

Posted in C language (en) | Leave a comment

## C Language: Caesar Text Encryption

We continue to do homework in the Computer science CS50 (Harvard) course, and this time we need to write the program code and encrypt a text message. The essence of the ceasar.c task is that the program asks for the … Continue reading

Posted in C language (en) | Leave a comment

## C language: how many coins does the cashier give

While studying Greedy Algorithms at CS50 (Harvard), let’s solve the problem about coins (Cash.c). Let’s say you need to give change to a customer in a store and you want to minimize the number of coins you give out to … Continue reading

Posted in C language (en) | Leave a comment

## C Language: Checking Credit Card Number Using Luhn’s Algorithm

In the cs50 course (Harvard) there is a C programming problem to determine the correctness of a credit card number through the Luhn algorithm (credit.c). Let’s analyze this problem and show two more solutions. So. Any credit card has a … Continue reading

Posted in C language (en) | Leave a comment

## C language: draw a pyramid from Mario

An interesting puzzle for beginners from CS50 (Harvard). Task: draw a pyramid from the Mario (mario-less.c) game using # symbols (lattice or hash). The user is asked: “How many blocks to make a pyramid from?”, he enters a number and … Continue reading

Posted in C language (en) | Leave a comment

## [C language ] Arithmetic progressions and MMORPGs

I am an avid MMORPG player and for me learning to program becomes much more fun and interesting if the programs I write have some connection to the games. This is especially important when it comes to some abstract mathematical … Continue reading

Posted in C language (en) | Leave a comment

## [C language] Operation precedence

It seems to me that I formatted the priorities of K&R operations more successfully: → ( )  [ ]  ->  . ← !  ~  ++   – –   +  –  *  &  (type)  sizeof → *  /  % → … Continue reading

Posted in C language (en) | Leave a comment

## [C language] memcpy() function

I remember that when I saw the memcpy () function for the first time in the code, I did not understand what kind of unknown animal it was. No one even thought to write a comment that explains it (no, … Continue reading

Posted in C language (en) | Leave a comment

## [ C language] Symbolic I/O and Redirection (Chapter 8)

The eighth chapter in Steven Prata’s book “C Primer Plus” (in the new edition it is called “Character I/O and Input Validation”). EOF (end of file) – designation of the end of the file. Ctrl+Z on Windows, Ctrl+D on UNIX. … Continue reading

Posted in C language (en) | Leave a comment

## [C language ] Insidious newlines on input

While doing the last exercise in Chapter 7, I ran into a problem reading an input line if it contains a newline. Everywhere this is explained somewhat abstrusely, I will try on my fingers: The problem is that when you … Continue reading

Posted in C language (en) | Leave a comment

## [C language] Printf statement line break

I forgot how to properly “cut” long pieces of printf, so I decided to write this cheat sheet. Let’s say you have a long printf expression and you need to break it into several smaller ones for readability (or to … Continue reading

Posted in C language (en) | Leave a comment

## [C language ] Scanf character input (%d): infinite loop error

When completing tasks from the seventh chapter, for the first time I encountered a “pinched cycle”. Let’s say the user enters the character q into a field (don’t do this unless you have the ability to interrupt the program): #include … Continue reading

Posted in C language (en) | Leave a comment

## [C language] Programming Exercises (Chapter 7)

Tasks from the seventh chapter of Stephen Prata’s book “C Primer Plus” – “C Control Operators: Branching and Jumps”. 1. Write a program that reads input until a # character is encountered, and then displays the number of spaces read, … Continue reading

Posted in C language (en) | Leave a comment

## [C language] C Control Statements: Branching and Jumping (Chapter 7)

The seventh chapter in Stephen Prata’s C Primer Plus. I want to start with a suitable divisors.c program For a given integer, you need to print all the integers by which the given number is divisible without a remainder; if … Continue reading

Posted in C language (en) | Leave a comment

## [C language] Programming Exercises: Loops and Arrays (Chapter 6)

The long-awaited moment has come to do “homework” on the sixth chapter of Stephen Prata’s book “C Primer Plus”. We are waiting for as many as 18 exciting tasks. 1. Write a program that creates an array of 26 elements … Continue reading

Posted in C language (en) | Leave a comment

## [C language] Mysterious scanf and %c: enter a phrase, not a character

I want to share a separate post with a very non-trivial task from the point of view of a beginner in C. It is the eighth self-monitoring question in chapter 6 of Stephen Prat’s C Primer Plus. The task is: … Continue reading

Posted in C language (en) | Leave a comment

## [C language] Control Statements: Loops (Chapter 6)

Synopsis: The sixth chapter in Stephen Prata’s C Primer Plus. Loop with precondition: for (initialization; examination; update)           operator Initializing expression → test expression → corrective expression Loop with postcondition: do     operator while (expression) … Continue reading

Posted in C language (en) | Leave a comment