Swarna Mam Lab Report
Swarna Mam Lab Report
Title-2 1D Array 03
Title-4 Pattern 07
1
Title-01: Armstrong Number
Problem description: Write a C program to find out if a given
number is a "Armstrong Number".
Code:
Output:
2
Title-02: 1D Array
Problem description:
• Take two 1-D float array A[5], B[5] as input with size 5.
• Again take five 1-D arrays
1. Summation
2. Subtraction
3. Multiplication
4. Division
5. Modulo
Code:
3
4
Output:
5
Title -03: Summation of array elements.
Problem description: Add last two digits of your roll in each variable you
have used in the code.
Code:
6
Output:
Title-04: Pattern
Problem description:
Print Series
a.
1+2+3+4+.......................+11
b.
1++3+5+.......................+11
c.
2+4+.......................+11
d.
1+2/3+4/5+6/7....................../11+
5. print pattern:
*
**
7
***
****
*****
Code: Output:
Code: Output:
8
Code: Output:
Code: Output:
Problem description:
Print pattern
1
212
9
32123
4321234
543212345
Code:
Output:
10
ap
pyb
irth
day110
Code:
Output:
Problem description:
11
C Program to Access Array Elements Using Pointer
To understand this example, you should have the knowledge of the following C
programming topics:
• C for Loop
• C Arrays
• C Pointers
• Relationship Between Arrays and Pointers
Code: Output:
12
--------------------------------------------
Input the string : This is test string
Input the position to start extraction :9
Input the length of substring :4
The substring retrieve from the string is : " test "
Code:
Output:
13
Title-09: STRUCT
Problem description:
take 5 student's information as input and calculate their GPA using STRUCT
Number of students: 2
number of subject: 2
enter information of student1:
name: A
roll: 1
mark:
subject1: 100
subject2: 90
output:
A+
A+
14
Code:
15
Output:
16
Title-10: Using file read, write
Problem description:
Create a program that reads data from a text file (input.txt), processes the data, and
writes the processed data to another text file (output.txt).
Code:
17
Output:
Code:
Output:
18