Uploaded by Khin Maung Chit

II EC SEM II LAB 1Q

advertisement
MINISTERY OF SCIENCE AND TECHNOLOGY
WEST YANGON TECHNOLOGICAL UNIVERSITY
DEPARTMENT OF ELECTRONIC ENGINEERING
LABORATORY INSTRUCTION
Academic Year (2023-2024)
Semester II
Year
…………………………………………………….
Subject
…………………………………………………….
Teacher Name …………………………………………………….
Submitted by
Name
……………………..
Roll No.
……………………..
Date
……………………..
Laboratory Report Cover Sheet
Name
:
Roll No
:
Laboratory Name
:
Particulars
Date of
Date of
Attendance
Conduction Submission
Max. Marks
Experiment I
Experiment II
Experiment III
Experiment IV
Experiment V
Practical and
Total
lab report
5
20
Obtained
Marks
25
EXPERIMENT II
Write a C program to specify the array size and to initialize the elements of a 10-element array s to the
even integers from 2 to 20 and then prints the array in tabular format. The values are generated by
multiplying the loop counter by 2 and adding 2.
Objectives
Upon the completion of this activity, the student will be able

To write C program from given problem statement.

To write C program by specifying an Array’s Size with a Symbolic Constant

To use the for statement.
Required Equipments:

Computer Laptop PC/Mobile phone

Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
Q1. Write the short command “odd integer” element initializing array with calculations.
…………………………………………………………………………………
Q2. Is this true s[SIZE] command for Array’s Size.
…………………………………………………………………………………
EXPERIMENT I
Write a C program to print the values of 10 element integer array n with an initializer list. The value
of integer array n is n[10]={32,27,64,18,95,14,90,70,60,37}.
Objectives
Upon the completion of this activity, the student will be able

To write C program from given problem statement.

To write C program by specifying an Array’s Size with a initializer list.

To use the for statement.
Required Equipments:

Computer Laptop PC/Mobile phone

Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
EXPERIMENT III
Write a C program to read the numbers from an array and to graph the information in the form of
a bar chart or histogram. The value of integer array n is n[10]={19,3,15,7,11,9,13,5,17,1}.
Objectives
Upon the completion of this activity, the student will be able

To write C program from given problem statement.

To write C program by specifying an Array’s Size with a Symbolic Constant

To use the for repetition statement.
Required Equipments:

Computer Laptop PC/Mobile phone

Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
Q1. Can replace in this symbol “*” others symbols such as “ @,#,$”?(Yes or No)
………………………………………………………………………………………
EXPERIMENT V
Write a C program to initialize the multiple – subscripted arrays. The program defines three arrays of
two rows and three columns.
int array 1[2][3]={{1,2,3},{4,5,6}};
int array 2[2][3]={1,2,3,4,5};
int array 3[2][3]={{1,2},{4}};
Objectives
Upon the completion of this activity, the student will be able

To write C program from given problem statement.

To write C program by specifying an Array’s Size with a Symbolic Constant

To use the for repetition statement.
Required Equipments:

Computer Laptop PC/Mobile phone

Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
EXPERIMENT IV
Write a C program to sort the values of 10-elements array a into ascending order. The data items in
original order is a[SIZE]={2,6,4,8,10,12,89,68,45,37}.
Objectives
Upon the completion of this activity, the student will be able
 To write C program from given problem statement.
 To write C program by specifying an Array’s Size.
 To use the for repetition statement.
Required Equipments:
 Computer Laptop PC/Mobile phone
 Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
Q1. As these question in lecture, a[SIZE]={2,6,4,8,10,12,89,68,45,37} was described. In test
experiment,b[SIZE] is written. Can execute program?
…………………………………………………………………………………………………
…………………………………………………………………………………………………………
EXPERIMENT II
Write a C program to pass the variable number to function cubeByValue using call-by-value.The
cubeByValue function cubes its argument(variable n) and passes the new value back to main using a
return statement.
Objectives
Upon the completion of this activity, the student will be able
 To write C program from given problem statement.
 To write C program by using the user defined function.
Required Equipments:
 Computer Laptop PC/Mobile phone
 Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
Q1. If the original value of number is 3, what is the new of number?
…………………………………………………………………………………………………
……………………………………………………………………………………………………..
EXPERIMENT I
Write a C program to demonstrate the pointer operators & and * operators are complement of one
another when they are both applied consecutively to aPtr in either order,the same result is printed.
Objectives
Upon the completion of this activity, the student will be able
 To write C program from given problem statement.
 To write C program by using the user defined function.
Required Equipments:
 Computer Laptop PC/Mobile phone
 Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
EXPERIMENT IV
Write a C program to convert a string of character “characters and $32.98” to Uppercase using a NonConstant Pointer to Non-Constant Data.
Objectives
Upon the completion of this activity, the student will be able

To write C program from given problem statement.

To write C program by using the user defined function.

To use the while and if statement.
Required Equipments:

Computer Laptop PC/Mobile phone

Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
Q1. Why is the ctype.h header file used?
…………………………………………………………………………………………………………
……………………………………………………………………………………………..
EXPERIMENT III
Write a C program to calculate a cube of variable n using call-by-reference with a pointer argument.
Objectives
Upon the completion of this activity, the student will be able

To write C program from given problem statement.

To write C program by using the user defined function.
Required Equipments:

Computer Laptop PC/Mobile phone

Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
Q1. What is Call-By-Reference?
…………………………………………………………………………………………………
……………………………………………………………………………………………………..
EXPERIMENT V
Write a C program to print a string of one character “print characters of a string” at a one time using a
“Non-Constant Pointer to Constant Data.
Objectives
Upon the completion of this activity, the student will be able

To write C program from given problem statement.

To write C program by using the user defined function.

To use the for statement.
Required Equipments:

Computer Laptop PC/Mobile phone

Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
EXPERIMENT
Write a C program to determine the size of ptr and array for the 20 elements and to calculate the
number of bytes used to store each of the standard data types.
Objectives
Upon the completion of this activity, the student will be able

To write C program from given problem statement.

To determine the standard data type sizes using operator sizeof
Required Equipments:

Computer Laptop PC/Mobile phone

Mobile C software, Dev++(free C)
Practical C Program
2
Display Output
Q1. What is the sizeof array for 10 elements.
……………………………………………………………………………………………
Download