Condition Statements in c

Task: Given a positive integer denoting n, do the following: If 1<=n<=9, print the lowercase English word corresponding to the number (e.g., one for 1, two for 2, etc.). If n>9, print Greater than 9. Input Format: The first line contains a single integer, n. Constraints: 1<=n<=10^9 Output Format: If 1<=n<=9, then print the lowercase English word corresponding to the number (e.g., one for 1, two for 2, etc.); otherwise, print Greater than 9 instead.

View Solution →

For Loops in c

Objective: In this challenge, you will learn the usage of the for loop, which is a programming language statement which allows code to be executed until a terminal condition is met. They can even repeat forever if the terminal condition is never met. The syntax for the for loop is: for ( <expression_1> ; <expression_2> ; <expression_3> ) <statement> 1. expression_1 is used for intializing variables which are generally used for controlling the terminating flag for the loop. 2. e

View Solution →

Sum of Digits of a Five Digit Number

Objective: The modulo operator, %, returns the remainder of a division. For example, 4 % 3 = 1 and 12 % 10 = 2. The ordinary division operator, /, returns a truncated integer value when performed on integers. For example, 5 / 3 = 1. To get the last digit of a number in base 10, use 10 as the modulo divisor. Task: Given a five digit integer, print the sum of its digits. Input Format: The input contains a single five digit number, . Constraints: 10000<=n<=99999 Output

View Solution →

Bitwise Operators

Example: n=3 k=4 The results of the comparisons are below: a b and or xor 1 2 0 3 3 1 3 1 3 2 2 3 2 3 1 For the and comparison, the maximum is 2. For the or comparison, none of the values is less than k, so the maximum is 0. For the xor comparison, the maximum value less than k is 2. The function should print: 2 0 2 Function Description: Complete the calculate_the_maximum function in the editor below. calculate_the_maximum has the following par

View Solution →

Printing Pattern Using Loops

Print a pattern of numbers from 1 to n as shown below. Each of the numbers is separated by a single space. 4 4 4 4 4 4 4 4 3 3 3 3 3 4 4 3 2 2 2 3 4 4 3 2 1 2 3 4 4 3 2 2 2 3 4 4 3 3 3 3 3 4 4 4 4 4 4 4 4 Input Format: The input will contain a single integer n.

View Solution →