MCSL-017 C and Assembly Language Programming Lab
MCSL-017 C and Assembly Language Programming Lab
com
There are two questions in this assignment carrying a total of 40 marks. Your Lab Record will
carry 40 Marks. Rest 10 marks are for viva voce. You may use illustrations and diagrams to
enhance the explanations. Please go through the guidelines regarding assignments given in
the Programme Guide for the format of presentation. Submit the screenshots along with the
coding and documentation.
Disclaimer: This Assignment is prepared by our students. The Institution and publisher are not
responsible for any omission and errors.
Ans 1.
Structure is a user-defined data type in C which allows you to combine different data
types to store a particular type of record. Structure helps to construct a complex data
type in more meaningful way. It is somewhat similar to an Array. The only difference is
that array is used to store collection of similar datatypes while structure can store
collection of any type of data.
Array of Structure:
#include<stdio.h>
#include<conio.h>
struct Student
{
char name[20];
int enroll;
char address[40];
Course Code : MCSL-017
Course Title : C and Assembly Language Programming (Lab Course)
Assignment Number : MCA(1)/L-017/Assignment/16-17 http://ignousolvedassignments.com
IGNOU Solved Assignments By http://ignousolvedassignments.com
char program[10];
char course[10];
int num;
float marks;
}s[4];
in main()
{
int i ;
for(i = 1;i <=4;i++)
{
printf("Enter Information : \n");
printf("Enter Name:");
gets(s[i].name)
printf("Enter Enrollment Number:\n");
scanf("%d",s[i].enroll);
printf("Enter Address:\n");
scanf("%d",s[i].address);
printf("Enter Programme:\n");
scanf("%d",s[i].program);
printf("Enter Course\n");
scanf("%d",s[i].course);
printf("Enter Contact Number\n:");
scanf("%d",s[i].num);
printf("Enter Marks:\n");
scanf("%d",s[i].marks);
printf("Contact Number\n:");
printf("%d",s[i].num);
printf("Marks\n:");
printf("%d",s[i].marks);
return 0;
Output:
Enter Information :
XYZ
Enter Enrollment Number:345653
Enter Address:Varanasi
Enter Programme:Mca
Enter Course:Mca Sem 1
Enter Contact Number:34567872
Enter Marks:89
Information Of Students
Name:XYZ
Enrollment Number:345653
Address:Varanasi
Programme:Mca
Course:Mca Sem 1
Contact Number:34567872
Marks:89
Enter Information :
XYZ1
Enter Enrollment Number:34542
Enter Address:Gorakhpur
Enter Programme:Mca
Enter Course:Mca Sem 1
Enter Contact Number:1245673
Enter Marks:67
Information Of Students
Name:XYZ1
Enrollment Number:34542
Course Code : MCSL-017
Course Title : C and Assembly Language Programming (Lab Course)
Assignment Number : MCA(1)/L-017/Assignment/16-17 http://ignousolvedassignments.com
IGNOU Solved Assignments By http://ignousolvedassignments.com
Address:Gorakhpur
Programme:Mca
Course:Mca Sem 1
Contact Number:1245673
Marks:67
Enter Information :
ABC
Enter Enrollment Number:345678
Enter Address:Varanasi
Enter Programme:Mca
Enter Course:Mca Sem 1
Enter Contact Number:34566872
Enter Marks:89
Information Of Students
Name:ABC
Enrollment Number:345678
Address:Varanasi
Programme:Mca
Course:Mca Sem 1
Contact Number:34566872
Marks:89
Enter Information :
ZCF
Enter Enrollment Number:3145653
Enter Address:Varanasi
Enter Programme:Mca
Enter Course:Mca Sem 1
Enter Contact Number:345676872
Enter Marks:89
Information Of Students
Name:ZCF
Enrollment Number:3145653
Address:Varanasi
Programme:Mca
Course:Mca Sem 1
Contact Number:345676872
Marks:89
1.(a) Write a program in assembly language to find if two given strings are of
equal length.
Ans 1 (a)
Assembly language is a low-level programming language for a computer or other
programmable device specific to a particular computer architecture in contrast to most
high-level programming languages, which are generally portable across multiple
systems. Assembly language is converted into executable machine code by a utility
program referred to as an assembler like NASM, MASM, etc.
(b) Write a program in assembly language to find the factorial of any number
(assume number is smaller than 10).
Ans(b).
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of
all positive integers less than or equal to n.
The factorial of a positive integer n is equal to 1*2*3*...n.
(c) Write a program in assembly language for reversing a four byte string.
Ans(c)
The variable length strings can have as many characters as required. Generally, we
specify the length of the string by either of the two ways
(d) Write a program in assembly language for finding the largest number in an
array of 10 elements.
Ans(d)
Arrays a kind of data structure that can store a fixed-size sequential collection of
elements of the same type. An array is used to store a collection of data, but it is often
more useful to think of an array as a collection of variables of the same type.
The above definition declares an array of six words each initialized with the numbers 34,
45, 56, 67, 75, 89. This allocates 2x6 = 12 bytes of consecutive memory space. The
symbolic address of the first number will be NUMBERS and that of the second number
will be NUMBERS + 2 and so on.