Looking for accurate SEBA Class 10 Computer Science Chapter 4 (Introduction to Loops) textual solutions for the 2026–27 academic year? Access step-by-step textbook exercise answers, detailed C program codes, for/while/do-while loop syntax, condition control explanations, and flowchart logic designed to help you score top marks in your HSLC board exams.

Q1. Why do we use a loop in a C program?
Answer:
A loop is used in a C program to repeat a task until a condition is met.

We use loops for the following reasons:

1. Saves Time and Effort: Loops stop us from writing the same code again and again.

2. Makes Code Shorter: Loops help reduce the total lines of code in a program.

3. Helps Read Data: Loops allow us to go through items in arrays easily.

Class 10 Computer Science Chapter 4 Question Answer SEBA 2026-27

Q2. Do we need to use only one type of loop in a C program? Justify your answer by writing a C program.
Answer:-

No, in C programming, you are not limited to using just one type of loop. Depending on the specific requirements of a program, you can choose between different loop types, including –

#include

int main()
{
int i;
printf(“Using a for loop to print numbers from 1 to 5:\n”);
for (i = 1; i <= 5; i++)
{
printf(“%d “, i);
}

printf(“\n”);
printf(“Using a while loop to print numbers from 6 to 10:\n”);
i = 6;
while (i <= 10)
{
printf(“%d “, i);
i++;
}
printf(“\n”);
printf(“Using a do-while loop to print numbers from 11 to 15:\n”);
i = 11;
do
{
printf(“%d “, i);
i++;
} while (i <= 15);
printf(“\n”);
return 0;
}

OUTPUT
Using a for loop to print numbers from 1 to 5:
1 2 3 4 5


Using a while loop to print numbers from 6 to 10:
6 7 8 9 10


Using a do-while loop to print numbers from 11 to 15:
11 12 13 14 15

Introduction to Loops Class 10 SEBA Textual Exercise Solutions

Q3. What will happen if we write a while loop with 1 in place of the condition ? Try it in a simple C program. Hint:
while (1)
{
printf(“We must raise our voice against corruption \n”);
}

Answer:-

In C programming, if you use 1 as the condition in a while loop, it will run forever because 1 always means true. This creates an infinite loop, and the program won’t stop by itself.
To exit this loop, you need to use a conditional statement along with a break statement.

Example:

#include

int main()
{
while (1)
{
printf(“This is an infinite loop.\n”);
}
return 0;
}

SEBA Class 10 Computer Science Chapter 4 Loop Programs

Q4. Name different portions of a for loop. Can we put more than one statement within a portion?
Answers:-

A for loop has three parts:

1)Initialization – This is where you set a starting value.
2)Condition – This checks if the loop should keep running.
3)Update – This changes the value after each loop.

Yes, you can add more than one statement in any part of the loop by separating them with commas.

Q5. Answer with TRUE or FALSE.

(i) If the condition of the while loop is false, the control comes to the second statement inside the loop.
Ans.
FALSE.


(ii) We can use at most three loops in a single C program.
Ans .
FALSE.


(iii) The statements inside the do-while loop executes at least once even if the condition is false.
Ans.
TRUE.


(iv) Only the first statement inside the do-while loop executes when the condition is false.
Ans.
FALSE.


(v) In a do-while loop, the condition is written at the end of the loop.
Ans.
TRUE.

HSLC Computer Science Chapter 4 Question Answer

Q6. Programming exercises:


A. Write a C program to find the summation of the following series

(a). 12 + 22 + 32 + 42 + . . . + N2

#include<stdio.h>
int main()

{
int N, a, sum = 0;
printf(“Enter a positive integer N: “);
scanf(“%d”, &N);
for (int i = 1; i <= N; i++)

{
a= i * i;
sum=sum+a;
}
printf(“The sum of squares from 1² to %d² is: %d\n”, N, sum);
return 0;
}

Output:
Enter a positive integer N: 5
The sum of squares from 1² to 5² is: 55

(b). 13 + 23 + 33 + 43 + . . . + N3

#include <stdio.h>

int main()

{

    int i, N, sum = 0;

    printf(“Enter the value of N: “);

    scanf(“%d”, &N);

    for (i = 1; i <= N; i++)

{

        int cube = i * i * i;

        sum = sum + cube;

    }

    printf(“\nThe summation of cubes is %d\n”, sum);

    return 0;

}

Output:

Enter the value of N: 4

The summation of cubes is 100

(c). 12 + 23 + 34 + . . . + N(N+1)

#include <stdio.h>

int main()

{

    int N, sum = 0;

    printf(“Enter a positive integer N: “);

    scanf(“%d”, &N);

    for (int i = 1; i <= N; i++)

{

        a= i * (i + 1);

       sum=sum+a;

    }

    printf(“The sum of products is: %d\n”, sum);

    return 0;

}

Output: 

Enter a positive integer N: 5

The sum of products is: 55

B. Write a C program to continuously take a number as input and announce whether the number is odd or even. Hint: use do-while loop.

C. Write a C program to display the following pattern.
1
1 1
1 1 1
1 1 1 1
1 1 1 1 1

#include

int main()
{

for(int i=1;i<=1;i++)
printf(“1”);
printf(“\n”);
for(int i=1;i<=2;i++)
printf(“1”);
printf(“\n”);
for(int i=1;i<=3;i++)
printf(“1”);
printf(“\n”);
for(int i=1;i<=4;i++)
printf(“1”);
printf(“\n”);
for(int i=1;i<=5;i++)
printf(“1”);
printf(“\n”);

return 0;
}

Using Nested Loop

#include<stdio.h>
int main()
{

for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
printf(“1”);
}
printf(“\n”);

}

return 0;
}

D. Write a C program to display the following pattern.
5
5 4
5 4 3
5 4 3 2
5 4 3 2 1

#include<stdio.h>
int main()
{

for(int i=5;i>=5;i–)
printf(“%d”,i);
printf(“\n”);
for(int i=5;i>=4;i–)
printf(“%d”,i);
printf(“\n”);
for(int i=5;i>=3;i–)
printf(“%d”,i);
printf(“\n”);
for(int i=5;i>=2;i–)
printf(“%d”,i);
printf(“\n”);
for(int i=5;i>=1;i–)
printf(“%d”,i);
printf(“\n”);

return 0;
}

Using Nested Loop

#include<stdio.h>
int main()
{

for(int i=5;i>=1;i–)
{
for(int j=5;j>=i;j–)
{
printf(“%d”,j);
}
printf(“\n”);

}

return 0;
}

E. Write a C program to display the following pattern.
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5

#include<stdio.h>
int main()
{

for(int i=5;i>=1;i-–)
printf(“%d”,i);
printf(“\n”);
for(int i=5;i>=2;i-–)
printf(“%d”,i);
printf(“\n”);
for(int i=5;i>=3;i–-)
printf(“%d”,i);
printf(“\n”);
for(int i=5;i>=4;i–-)
printf(“%d”,i);
printf(“\n”);
for(int i=5;i>=5;i–-)
printf(“%d”,i);
printf(“\n”);

return 0;
}

Using Nested Loop

#include<stdio.h>
int main()
{

for(int i=1;i<=5;i++) { for(int j=5;j>=i;j-–)
{
printf(“%d”,j);
}
printf(“\n”);

}

return 0;
}

💻 Updated Solutions Notice: This page features complete, step-by-step SEBA Class 10 Computer Science Chapter 4 (Introduction to Loops) Textual Exercise Solutions updated for the 2026–27 academic session. All C programming loop logic, iteration structures, and textbook exercise answers strictly follow the latest revised Assam Board (SEBA) textbook.

💡 Ace Your HSLC Computer Science Exam:

Leave a Reply

Your email address will not be published. Required fields are marked *