Build a C program to demonstrate the usage of different types of literals: integer, float, character, and string.
To build a C program that prints integer, float,character, and string literals on the console using the printf() function.
Start
Include the standard input-output library: #include<stdio.h>.
Inside the main() function, use printf() to display each literal along with its size in bytes using sizeof() :
3.1 Integer literal (e.g., 10) using %d
3.2 Float literal (e.g., 3.14) using %f
3.3 Character literal (e.g., 'A') using %c
3.4 String literal (e.g., "Hello C") using %s
Stop
Thus, the program was implemented and executed successfully, and the required output was obtained.
Build a C program to display the value of a macro constant and a constant variable.
To build a C program that demonstrates the use of macro constants and constant variables.
Start
Include the standard input-output library: #include<stdio.h>.
Define a macro constant PI with value 3.14159 using #define.
Inside main():
4.1 Declare a constant integer variable DAYS
4.2 Initialize it with the value 7
Use printf() to display the values of PI and DAYS.
Stop
Thus, the program was implemented and executed successfully, and the required output was obtained.
Build a C program to demonstrate the use of different data types such as int, float, double, and char, and display their values using printf().
To build a C program that declares variables of various data types—integer, float, double, and character—initializes them, and prints their values on the screen.
Start
Include the standard input-output library: #include<stdio.h>.
Inside main(), declare and initialize variables of types int, float, double, and char.
Display their values using printf().
Stop
Thus, the program was implemented and executed successfully, and the required output was obtained.
Build a C program to perform arithmetic and bitwise operations on two integers entered by the user. The program should display: Arithmetic operations: addition, subtraction, multiplication, division, and remainder. Bitwise operations: AND, OR, XOR, left shift, right shift, and NOT.
To build a C program that takes two integers as input and demonstrates the arithmetic and bitwise operations, displaying the results of each operation.
Start
Include the standard input-output library: #include<stdio.h>.
Declare two integer variables a and b.
Prompt the user to enter two integers and read the input using scanf().
Perform arithmetic operations on a and b:
Perform bitwise operations on a and b:
Display the results of all operations using printf().
Stop
Thus, the program was implemented and executed successfully, and the required output was obtained.
Develop a C program to check whether a given character is a vowel, consonant, digit, or special symbol using the ternary operator.
To develop and implement a C program that classifies a character as a vowel, consonant, digit, or special symbol using the ternary operator.
Start
Include the standard input-output library: #include<stdio.h>.
Input a character ch from the user.
Check if ch is a digit ('0' to '9').
If true → Print "Digit" → Go to Step 8.
If false → Go to Step 5.
Check if ch is an alphabet letter ('A' - 'Z' or 'a' – 'z').
If true → Go to Step 6.
If false → Go to Step 7.
Check if ch is a vowel (a, e, i, o, u or A, E, I, O, U).
If true → Print "Vowel" → Go to Step 8.
If false → Print "Consonant" → Go to Step 8.
Print "Special Symbol".
Stop
Thus, the program was implemented and executed successfully, and the required output was obtained.