Your SlideShare is downloading. ×
Test 1 alish schema 1
Test 1 alish schema 1
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Test 1 alish schema 1

196

Published on

Published in: Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
196
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
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(); }

×