RSA Conference Exhibitor List 2024 - Exhibitors Data
Test 1 alish schema 1
1. UNIVERSITI TUN HUSSEIN ONN MALAYSIA
FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING
BTI 10202: COMPUTER PROGRAMMING
TEST 1
NAME : _____________________________________ MARKS
MATRICS NO.: _______________ DATE : ________
Write a program to calculate cost of installing tiles in a room. Calculation should be in Meter Square (m2).
The user may choose from two different tile sizes:
20 cm x 20 20 cm x 10
cm cm
RM3.00
The output should be similar to:
Please save your file on desktop as <matrixcard>_<yourname>.c
2. Answer:
#include<stdio.h>
#include<conio.h>
main(){
float lb, wb,roomsize=0,ttile=0,cost=0,unit; 3m
int tile;
reenter:
printf("nt***Tile Calculator(Metric) And Invoice generator***nn1. 20cm x 20cmn2. 20cm x
10cmnPlease choose your tile size: ");
scanf("%d",&tile);
2m
if(tile!=1 && tile!=2) {goto reenter;}
printf("nPlease enter room length(m): "); I/p 1m
scanf("%f",&lb);
printf("nPlease enter room width(m): ");
scanf("%f",&wb);
roomsize=lb*wb; 1m
switch(tile){
case 1:
unit=3.0;
ttile=roomsize/4;
cost=ttile*unit;break;
case 2: 2m
unit=2.0;
ttile=roomsize/2 ;
cost=ttile*unit;break;
}
printf("nnttt****INVOICE****n");
printf("nProduct No.tRoom SizetNo.Tile tCost/tiletTotal"); O/p1m
printf("n-----------------------------------------------------------------------");
printf("nt%dt%7.2ftt%6.1fttRM%6.2ftRM%6.2f",tile,roomsize,ttile,unit,cost);
Run w/o error 3m
2m??
getch();
}