IGNOU MCA Assignment: C Programs for Telephone Bill, Rectangle Perimeter, Square, Exams of Computer Science

Information about various assignments given in the mca (master of computer applications) course at ignou (indira gandhi national open university) under the c and assembly language programming lab course (mcs-017). The assignments include writing an interactive c program to generate telephone bills, a program in assembly language to find the perimeter of a rectangle, a program to find the square of a number in assembly language, and a program to reverse a number and check if it is a palindrome in assembly language. The assignments require the students to write, execute, and submit the program logic, sample input, and output along with necessary documentation.

Typology: Exams

2017/2018

Uploaded on 05/01/2018

pruthviraj-
pruthviraj- 🇮🇳

2 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Ignousolvedassignments.com
Thanks for visiting us!! Subscribe!! Pag e 1
A C program to generate Telephone Bill for
Consumer IGNOU MCA Assignment 2015 16
M A S T E R OF COMPUTER A P P L I C A T I O N S
Course Code : MCSL-017
Course Title : C and Assembly Language Programming (Lab Course)
Assignment Number : MCA(I)/L-017/Assignment/15-16
Maximum Marks : 100
Weightage : 25%
Write an interactive program in C language to create an application program which
generates the telephone bills. It stores various details of users Telephone Number, Name,
Address, No. of calls, local or STD/ISD call. Compute the amount to be paid if the charges
per local call is Rs. 2/- and for STD/ISD call is Rs. 5/-. It should have feature of searching
the customer records usin g the telephone number. The application should be designed
user-friendly.
Note: You must execute the program and submit the program logic, sample input and output
along with the necessary documentation for this question. Assumptions can be made wherever
necessary.
#include<stdio.h>
#include<dos.h>
struct consumer
{
int TEL_NO;
char NAME[10];
char ADDRESS[25];
int LOCAL;
int STD_ISD;
}USER[12]={
{25621,”GANESH”,”KACHPADA,MALAD W”,15,5},
{25622,”MAHESH”,”DOMNIC COLONY,MALAD W”,30,0},
{25623,”SURESH”,”SUNDER NAGAR MALAD W”,128,15},
{25624,”KALPESH”,”KACHPADA,MALAD W”,826,7},
{25625,”RAHUL”,”DOMNIC COLONY,MALAD W”,24,3},
{25626,”SUBBU”,”SUNDER NAGAR MALAD W”,475,0},
{25627,”RAKESH”,”BHADRAN NAGAR MALAD W”,97,7},
{25628,”ATUL”,”KACHPADA,MALAD W”,152,45},
{25629,”DHARMESH”,”SUNDER NAGAR MALAD W”,326,45},
{25630,”AJAY”,”BHADRAN NAGAR MALAD W”,216,12},
{25631,”ABDUL”,”DOMNIC COLONY,MALAD W”,127,1},
{25632,”RASHMI”,”KACHPADA,MALAD W”,95,5}
};
void main()
{
int TELNO;
void gen_bill(int);
clrscr();
printf(“ENTER TELEPHONE NO.(BTWN 25621 TO 25632) TO GENERATE BILL : “);
scanf(“%d”,&TELNO);
if(TELNO>25620 && TELNO<25633)
gen_bill(TELNO);
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download IGNOU MCA Assignment: C Programs for Telephone Bill, Rectangle Perimeter, Square and more Exams Computer Science in PDF only on Docsity!

Thanks for visiting us!! Subscribe!!  Page 1

A C program to generate Telephone Bill for

Consumer – IGNOU MCA Assignment 2015 – 16

MASTER OF COMPUTER APPLICATIONS

Course Code : MCSL- 017 Course Title : C and Assembly Language Programming (Lab Course) Assignment Number : MCA(I)/L-017/Assignment/15- 16 Maximum Marks : 100 Weightage : 25% Write an interactive program in C language to create an application program which generates the telephone bills. It stores various details of users Telephone Number, Name, Address, No. of calls, local or STD/ISD call. Compute the amount to be paid if the charges per local call is Rs. 2/- and for STD/ISD call is Rs. 5/-. It should have feature of searching the customer records using the telephone number. The application should be designed user-friendly. Note: You must execute the program and submit the program logic, sample input and output along with the necessary documentation for this question. Assumptions can be made wherever necessary. #include<stdio.h> #include<dos.h> struct consumer { int TEL_NO; char NAME[10]; char ADDRESS[25]; int LOCAL; int STD_ISD; }USER[12]={ {25621,”GANESH”,”KACHPADA,MALAD W”,15,5}, {25622,”MAHESH”,”DOMNIC COLONY,MALAD W”,30,0}, {25623,”SURESH”,”SUNDER NAGAR MALAD W”,128,15}, {25624,”KALPESH”,”KACHPADA,MALAD W”,826,7}, {25625,”RAHUL”,”DOMNIC COLONY,MALAD W”,24,3}, {25626,”SUBBU”,”SUNDER NAGAR MALAD W”,475,0}, {25627,”RAKESH”,”BHADRAN NAGAR MALAD W”,97,7}, {25628,”ATUL”,”KACHPADA,MALAD W”,152,45}, {25629,”DHARMESH”,”SUNDER NAGAR MALAD W”,326,45}, {25630,”AJAY”,”BHADRAN NAGAR MALAD W”,216,12}, {25631,”ABDUL”,”DOMNIC COLONY,MALAD W”,127,1}, {25632,”RASHMI”,”KACHPADA,MALAD W”,95,5} }; void main() { int TELNO; void gen_bill(int); clrscr(); printf(“ENTER TELEPHONE NO.(BTWN 25621 TO 25632) TO GENERATE BILL : “); scanf(“%d”,&TELNO); if(TELNO>25620 && TELNO<25633) gen_bill(TELNO);

Thanks for visiting us!! Subscribe!!  Page 2 else printf(“\nYOU HAVE ENTERED WRONG TEL NO. !!”); getch(); } void gen_bill(int TELNO) { struct date D; float LOCAL_CH,STD_ISD_CH,SER_CH,T_CALLS,T_BILL,FIX_CH=750; getdate(&D); printf(“\n\n\t\t\t MUMBAI TELEPHONE NIGAM LIMITED.”); printf(“\n\t\t\t\tBILL SUMMARY\n\n”); LOCAL_CH=USER[TELNO-25621].LOCAL2; STD_ISD_CH=USER[TELNO-25621].STD_ISD5; T_CALLS=LOCAL_CH+STD_ISD_CH; SER_CH=(FIX_CH+T_CALLS)/10; T_BILL=FIX_CH+T_CALLS+SER_CH; printf(“\tCONS.NAME : %s\t\t\tBILL GEN. DATE:%d/%d/%d “,USER[TELNO- 25621].NAME,D.da_day,D.da_mon,D.da_year); printf(“\n\n\tADDRESS : %s\t\tBILL MONTH : %d %d\n”,USER[TELNO- 25621].ADDRESS,D.da_mon-1,D.da_year); printf(“\n\t_____________________________________________________________________ _”); printf(“\n\n\tNO. OF CALLS\t\t\t\tCHARGES\t\tAMOUNT(RS.)”); printf(“\n\t_____________________________________________________________________ _”); printf(“\n\n\tLOCAL :\t%d\t\t\tMONTHLY(FIXED) :\t%.0f”,USER[TELNO-25621].LOCAL,FIX_CH); printf(“\n\n\tSTD/ISD :\t%d\t\t\tCALL USAGE :\t%.0f”,USER[TELNO-25621].STD_ISD,T_CALLS); printf(“\n\n\t\t\t\t\t\tSERVICE TAX\t\t%.0f”,SER_CH); printf(“\n\t_____________________________________________________________________ _”); printf(“\n\n\t\t\t\t\t\tPAYABLE AMT\t\t%.0f”,T_BILL); printf(“\n\t_____________________________________________________________________ _”); } Code: -

A program in assembly language to find the

perimeter of a rectangle – IGNOU MCA Assignment

Thanks for visiting us!! Subscribe!!  Page 4

ADD AL,LEN

LEA SI,RES

CALL HEX2DEC

LEA DX,MSG

MOV AH,

INT 21H

LEA DX,RES

MOV AH,

INT 21H

MOV AH,4CH

INT 21H

CODE ENDS

HEX2DEC PROC NEAR

MOV CX,

MOV BX,

LOOP1: MOV DX,

DIV BX

ADD DL,30H

PUSH DX

INC CX

CMP AX,

JG LOOP

ADD AL,30H

MOV [SI],AL

LOOP2: POP AX

INC SI

MOV [SI],AL

LOOP LOOP

RET

HEX2DEC ENDP

END START

Program Code :

Assembly language program to find the Square of a

number – IGNOU MCA Assignment 2015 – 16

Q. Write a program in assembly language to find the Square of a given number. Course Code : MCS- 017 Course Title : C and Assembly Language Programming(Lab Course)

Thanks for visiting us!! Subscribe!!  Page 5 Assignment Number : MCA(I)/L-017/Assignment/15- 16 Maximum Marks : 100 Weightage : 25% Solution : DATA SEGMENT NUM DB? RES DB 10 DUP (‘$’) MSG1 DB “ENTER NUMBER : $” MSG2 DB 10,13,”SQUARE OF NUMBER IS : $” DATA ENDS CODE SEGMENT ASSUME DS:DATA,CS:CODE START: MOV AX,DATA MOV DS,AX LEA DX,MSG MOV AH, INT 21H MOV AH, INT 21H SUB AL,30H MOV NUM,AL MOV AH, MUL NUM LEA SI,RES CALL HEX2DEC LEA DX,MSG MOV AH, INT 21H LEA DX,RES MOV AH, INT 21H MOV AH,4CH INT 21H CODE ENDS HEX2DEC PROC NEAR MOV CX, MOV BX,1 0 LOOP1: MOV DX, DIV BX ADD DL,30H

Thanks for visiting us!! Subscribe!!  Page 7

DISPLAY MACRO MSG

MOV AH,

LEA DX,MSG

INT 21H

ENDM

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START:

MOV AX,DATA

MOV DS,AX

DISPLAY MSG

MOV AX,NUM

LEA SI,RES

CALL HEX2DEC

LEA DX,RES

MOV AH,

INT 21H

LEA SI,ARRY

MOV AX,NUM

REVE:

MOV DX,

MOV BX,

DIV BX

MOV ARRY[SI],DL

MOV TEMP,AX

MOV AX,DX

INC SI

MOV AX,TEMP

CMP TEMP,

JG REVE

LEA DI,ARRY

LAST:

INC DI

CMP ARRY[DI],

JG LAST

DEC DI

MOV AL,ARRY[DI]

MOV AH,

MOV NUM2,AX

MOV CX,

CONV:

DEC DI

MOV AL,ARRY[DI]

MOV AH,

MUL CX

ADD NUM2,AX

Thanks for visiting us!! Subscribe!!  Page 8

MOV AX,CX

MOV BX,

MUL BX

MOV CX,AX

CMP ARRY[DI],

JG CONV

DISPLAY MSG

MOV AX,NUM

LEA SI,RES

CALL HEX2DEC

LEA DX,RES

MOV AH,

INT 21H

MOV AX,NUM

CMP NUM2,AX

JE PALIN

DISPLAY MSG

JMP FINISH

PALIN:

DISPLAY MSG

FINISH: MOV AH,4CH

INT 21H

CODE ENDS

HEX2DEC PROC NEAR

MOV CX,

MOV BX,

LOOP1: MOV DX,

DIV BX

ADD DL,30H

PUSH DX

INC CX

CMP AX,

JG LOOP

ADD AL,30H

MOV [SI],AL

LOOP2: POP AX

INC SI

MOV [SI],AL

LOOP LOOP

RET

HEX2DEC ENDP

Thanks for visiting us!! Subscribe!!  Page 10

ENDS

END START