Test 1 alish schema 1

  • 176 views
Uploaded on

 

More in: Business , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
176
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
9
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 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.00The 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(); }