This file contains algorithms for respective experiments. These experiments are basic codes for Introduction To C- Programming. The other reporsitories contain the applicaiton and other important topics and their Experiments.
EXPERIMENT-1 (HELLO WORLD)
a. Start and include #include <stdio.h> .
b. Use printtf command and type "Hello World".
c. End program.
RESULT- The algorithm and the created code will print "Hello World".
EXPERIMENT-2 (PRINTF AND SCANF)
a. Start.
b. Enter the number(printf).
c. Scan the number(scanf).
d. Print the number(printf).
e. End.
EXPERIMENT-3 (IF-ELSE)
a. Start.
b. Enter the number(printf).
c. Scan the number(scanf).
d. If the number is greater than or equal to 6, print valid.
e. Else the number is lesser than 6, print Inv.
f. End.
EXPERIMENT-4 (POINTERS) A pointer is a variable that stores the memory address of another variable as its value.
a. Start.
b. Specify variable.
c. Create pointer variable *ap and store it in 'a'.
d. Create set of print f commands for: address and value of th evariable and the value of the pointer for the respective variable.
e. End.
EXPERIMENT-5 (STRUCTURES) Structures (also called structs) are a way to group several related variables into one place.
a. Start and declare struct before int main().
b. Include different data types, e.x. Employee or student details.
c. Print the name, year of joining and other details.
d. Store and print values by using &x.DETAIL.
e. Print all details.
f. End.
EXPERIMENT-6 (POWERS)
a.Start the program.
b. Declare an integer variable n.
c. Display a message "Enter a number: ".
d. Read an integer value from the user using the scanf function and store it in the variable n.
e. Check if the value of n is 0. If yes, print the message "%d is not a power of 2." where %d is replaced by the value of n.
f. If the value of n is not 0, check whether n & (n-1) is equal to 0.
-
If it is equal to 0, then n is a power of 2.
-
If it is not equal to 0, then n is not a power of 2.
g. Print the appropriate message based on the above checks.
h. End the program by returning 0.