0% found this document useful (0 votes)
12 views

Assignment 4

The document contains 57 programming questions related to loops in C language. It provides the problem statements and asks the reader to write source code and provide output for problems involving while, do-while and for loops to display sequences, numbers, tables, patterns and other output.

Uploaded by

shamrex088
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Assignment 4

The document contains 57 programming questions related to loops in C language. It provides the problem statements and asks the reader to write source code and provide output for problems involving while, do-while and for loops to display sequences, numbers, tables, patterns and other output.

Uploaded by

shamrex088
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 36

PROGRAMMING FUNDAMENTALS LAB

ASSIGNMENT # 4

UNIVERSITY OF SIALKOT

BSSE-1

BLUE

FALL 2023

Submitted by: SHAMRAIZ ALI

Roll no: 23101001-006

Submitted to: MAM MAHAM SAJID

Question 15
 write a program that displays counting from 1 to 10 using while loop.

Source Code:

Output:

Question 16
 Write a program that displays first five numbers and their sum using while loop.

Source Code:

 Output:
Question 17

 Write a program that displays first five numbers with their squares using while loop.

 Source Code:

 Output:
Question 18

 Write a program that inputs starting and ending number from the user and then displays
all even numbers in the given range.

 Source Code:

 Output:
Question 19

 Write a program that’s inputs a number from the user and displays a table of that number
using while loop.

Source Code:

 Output:
Question 20

 Write a program that displays the following series using while loop:
1 3 5 7 9 11 13 15 17 19 21.

Source Code:

 Output:
Question 21

 Write a program that inputs a number from the user and display the factorial of that
number using while loop.

Source Code:

 Output:
Question 22
Statement not completed. I’m unsure about that question.

Question 23

 Write a program that displays back counting from 10 to 1 using do while loop.

Source Code:

 Output:
Question 24

 Write a program that displays first five numbers with their cubes using do while loop.

Source Code:

 Output:
Question 25

 Write a program that displays first ten odd numbers using do while loop.

Source Code:

 Output:
Question 26

 Write a program that prints odd numbers from 11 to 49 using loop.

Source Code:

 Output:

Question 27

 Write a program that inputs a number from the user and displays the factorial of that
number using do while loop.
 Source Code:

 Output:

Question 28

 Write a program that inputs a number from the user and displays the table of that number
using do while loop.

Source Code:
Output:

Question 29

 Write a program that gets starting and ending point from the user and displays all odd
numbers in the given range using do while loop.

Source Code:
Output:

Question 30

 Write a program that gets two numbers from the user and displays the result of first
number raise to the power of second number using do while loop.
Question 31
 Write a program that displays the sum of the following series using do while loop.
1+1/3+1/5+1/7+…………. +1/99.
Question 32

 Write a program to display counting from 1 to 10.


Question 33
 Write a program to display alphabets from A to Z.

Question 34
 Write a program that displays first ten numbers and their average using for loop.
Question 35
 Write a program to print the sum of odd numbers between 1 to 10.
Question 36
 Write a program to print the sum of odd numbers between 1 and 100.

Question 37
 Write a program that inputs a number from the user and displays the factorial of that
number using for loop.
Question 38
 Write a program to displays a table of equivalent temperatures in Fahrenheit and Celsius from 50F
to 100F with an increment of 5.
Question 39
 Write a program that displays product of all odd numbers from 1 to 10 using for loop.

Question 40
 Write a program that inputs a number from the user and displays a table of that
number using for loop.
Question 41
 Write a program that inputs table number and length of table and then displays the
table using for loop.
Question 42

 Write a program that inputs an integer and displays its table in descending order
using for loop.
Question 43
 Write a program that finds the sum of squares of the integers from 1 to n. where n
is a positive value entered by the user (i.e., sum=12+22+33+……n2 ).

Question 44
 Write a program that prints all odd positive integers less than 100 skipping those
that are exactly divisible by 7.
Question 45
 Write a program in C language to print the following series.
0 3 6 9 12 15.
Question 46
 Write a program that displays the sum of positive odd numbers and the product of
positive even numbers from 1 to 10.
Question 47
 A class of 35 students takes an examination in which marks range from 0 to 100. Write a
program which finds: a. average marks b. number of failed student (marks below 50) P a g
e | 5 c. number of students who scored 100 marks.
Question 48
 Write a program to calculate and display the sum of following series using for loop.
Unsure about question. Statement incomplete.

Question 49
 Write a program that inputs a positive integer number from the keyboard and
display it is in reverse number. for example, the reverse of 345 is 543.
Question 50
 Write a problem to produce the following output:
0
01
014
0149
0 1 4 9 16
0 1 4 9 16 25
Question 51
 Write a program that displays the following block using nested for loop.
Unsure about question. Statement not completed.

Question 52
 Write a program that displays the following shape using nested loops. the outer
loop should be for loop and inner loop should while loop
*****
****
***
**
*

Question 53
 Write a program that displays the following using do while loop.
4444
333
22
1

Question 54
 Write a program that inputs an integer from the user. it displays the sum of
integers for each integer from 1 to the given integer.
Question 55
 Write a program that inputs an integer from the user. it displays the integer and its
factorial from 1 to the given integer.
Question 56
 Write a program that displays the following shape using nested for loop.
*
**
***

Question 57
 The following program display the following shape using nested for loops.
*****
****
***
**
*
Question 58
 Write a program that displays the following shape using nested for loops
*
**
***
****
END

You might also like