C PROGRAM LAB 2
C PROGRAM LAB 2
KATHMANDU, NEPAL
2024
Lab Sheet#6
C-PROGRAMMING
I would like to express my sincere gratitude to Sanjay Phuyal Sir for his invaluable
guidance and support throughout the completion of this lab report on C-
Programming. His encouragement and advice greatly enhanced my understanding
of the topic and practical aspects of C-Programming
I would also like to extend my thanks to Trinity International College & SS for
providing the necessary resources and a conductive learning environment. I would
like to express my gratitude to all for helping me to learn C-PROGRAMMING. I
would like Mr. Sanjay Phuyal for giving this lab project and helping me
understand this topic better.
Genuine Rajbhandari
Grade 11
MF1
OBECTIVES
I practiced to solve the program by the help of looping. This skill helped me to
start and execute the loop in C-Programming.
I learned how to make various codes, print different patterns, print the series and
nepal flag. etc on it. This skill was exciting because it made my work look more
professional and easier to understand.
The main objective for me was to understand how to use proper condition for
looping, using increment and decrement of looping properly to execute the loop in
right way. I feel more confident now because I can use C-Programming to handle
these tasks efficiently.
C for Loop………………..…………………………...…………… .1
1) for Loops..…………………………………………………………….2
3)do…while Loop……..………………………………………………...5
CONCLUSION ……………………………………………………………..6
REFERENCE………………………………………………………………..7
THEORY
C-Programming
The C programming language is a procedural and general-purpose
language that provides low-level access to system memory. A program
written in C must be run through a C compiler to convert it into an
executable that a computer can run. Many versions of Unix-based
operating systems (OSes) are written in C and it has been standardized as
part of the Portable Operating System Interface (POSIX).
C for Loop
1. for loop
2. while loop
3. do...while loop
We will learn about for loop in this tutorial. In the next tutorial, we will learn
about while and do...while loop.
1) for Loop
This process goes on until the test expression is false. When the test expression is
false, the loop terminates.
for loop Flowchart
1. for loop
2. while loop
3. do...while loop
In the previous tutorial, we learned about for loop. In this tutorial, we will learn
about while and do..while loop.
While loop
The while loop evaluates the test Expression inside the parentheses ().
If test Expression is true, statements inside the body of while loop are
executed. Then, test Expression is evaluated again.
The do..while loop is similar to the while loop with one important difference. The
body of do...while loop is executed at least once. Only then, the test expression is
evaluated.
do {
The body of do...while loop is executed once. Only then, the test
Expression is evaluated.
If test Expression is true, the body of the loop is executed again and test
Expression is evaluated once more.
2) https://www.programiz.com/c-programming/c-do-while-loops
3) https://learn.microsoft.com/en-us/cpp/c-language/c-language-
reference?view=msvc-170
4) https://www.geeksforgeeks.org/c-for-loop/