title-img


Playing with Characters

Objective: This challenge will help you to learn how to take a character, a string and a sentence as input in C. To take a single character ch as input, you can use scanf("%c", &ch ); and printf("%c", ch) writes a character specified by the argument char to stdout char ch; scanf("%c", &ch); printf("%c", ch); This piece of code prints the character ch. You can take a string as input in C using scanf(“%s”, s). But, it accepts string only until it finds the first space. In order to

View Solution →

Sum and Difference of Two Numbers

Objective: The fundamental data types in c are int, float and char. Today, we're discussing int and float data types. The printf() function prints the given statement to the console. The syntax is printf("format string",argument_list);. In the function, if we are using an integer, character, string or float as argument, then in the format string we have to write %d (integer), %c (character), %s (string), %f (float) respectively. The scanf() function reads the input data from the console

View Solution →

Functions in C

Objective: In this challenge, you will learn simple usage of functions in C. Functions are a bunch of statements grouped together. A function is provided with zero or more arguments, and it executes the statements on it. Based on the return type, it either returns nothing (void) or something. A sample syntax for a function is return_type function_name(arg_type_1 arg_1, arg_type_2 arg_2, ...) { ... ... ... [if return_type is non void] return

View Solution →

Pointers in c

Objective: In this challenge, you will learn to implement the basic functionalities of pointers in C. A pointer in C is a way to share a memory address among different contexts (primarily functions). They are primarily used whenever a function needs to modify the content of a variable that it does not own. In order to access the memory address of a variable, val, prepend it with & sign. For example, &val returns the memory address of val. This memory address is assigned to a pointer and

View Solution →

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 →