Who’s HACKER? | |
We’re Hiring toktok Driver | |
| | Program to determine area,perimeter of geometric shapes using coordinates | |
| | Author | Message |
---|
kulit™
Join Date : 2008-04-25 Location : Malabon City Age : 39 Cell Phone # : 09273560700 Posts : 367
| Subject: Program to determine area,perimeter of geometric shapes using coordinates August 20th 2012, 14:53 | |
| #include #include void main() //Program to determine area and perimeter of geometric shapes using the x,y coordinates { int choice,x1,y1,x2,y2,x3,y3,x4,y4; float a,b,c,r,A,P,l,w; // user chooses shape. printf("Welcome to Cartesian geometry! Please choose your shape by entering its number:\n"); printf("rectangle -> enter 1\n"); printf("circle -> enter 2\n"); printf("triangle -> enter 3\n"); printf("to exit -> enter 4\n"); scanf("%d", &choice); if (choice==1) { prinf("Please enter the coordinates for the rectangle from bottom left to right, then top right to left"); printf("\nenter value for x1:"); scanf("%d", &x1); printf("enter value for y1:"); scanf("%d", &y1); printf("enter value for x2:"); scanf("%d", &x2); printf("enter value for y2"); scanf("%d", &y2); printf("enter value for x3:"); scanf("%d", &x3); printf("enter value for y3:"); scanf("%d", &y3); printf("enter value for x4:"); scanf("%d", & x4); printf("enter value for y4:"); scanf("%d", &y4); l = (((x1-x2)^2 + (y1-y2)^2))^(1/2); w = (((x1-x4)^2 + (y1-y4)^2))^(1/2); A=l*w; printf("the area is %f\n", A); P=2*(l+w); printf("the perimeter is %f", P); } if (choice==2) { printf("Please enter the centre of the circle, and a point on the circle\n"); printf("enter value for x1\n"); scanf("%f", &x1); printf("enter value for y1\n"); scanf("%f", &y1); printf("enter value for x2\n"); scanf("%f", &x2); printf("enter value for y2\n"); scanf("%f", &y2); r=(((x2-x1)^2 + (y2-y1)^2))^(1/2); A=3.14*(r)^2; printf("\nThe Area of the triangle is %f", A); P=2*3.14*r; printf("The Perimeter of the triangle is %f", P); if (choice==3) { printf("Please enter the x,y coordinates of the triangle starting with the bottom left to right, then the top:"); scanf("%f", &x1); printf("\nenter value for y1"); scanf("%f", &y1); printf("please enter value for x2"); scanf("%f", &x2); printf("please enter value for y2"); scanf("%f", &y2); printf("enter value for x3"); scanf("%f", &x3); printf("enter value for y3"); scanf("%f", &y3); a=((x2-x1)^2 + (y2-y1)^2))^(1/2); b=((x3-x2)^2 + (y3-y2)^2))^(1/2); c=((x3-x1)^2 + (y3-y1)^2))^(1/2); A=(.25)*(((a^2+b^2+c^2))^(2) - (a^4+b^4+c^4))^(1/2); printf("The area is %f", A); P=a+b+c; printf("The perimeter is %f", P); if (choice>=4) { return 0; } } | |
| | | | Program to determine area,perimeter of geometric shapes using coordinates | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| Latest topics | » [HELP] Unlock Samsung Galaxy J1June 6th 2015, 09:04 by pitot0909» Need Help C3-00 Unlock codeJune 1st 2015, 09:12 by Blessings mkhumba » ONE CLICK PATTERN UNLOCK v3.0.2February 16th 2015, 08:54 by URDUKHAN » Samsung C3053 Keypad problem DONEDecember 17th 2014, 07:37 by fjengrova06 » Samsung i9100 galaxy s2, full shorted done... December 7th 2014, 09:19 by fjengrova06 » samsung galaxy y 5360.. hang done sa ODINNovember 6th 2014, 01:05 by razel16 » MRON BA KAYONG PROBLEMA SA SIGNAL?October 19th 2014, 11:13 by rufmeganz espedosa72 » s5380d security code done sa jurassic... :))October 8th 2014, 08:01 by MDS » meron bang taga bohol dito?August 2nd 2014, 11:14 by mmssanmiguel » 3110c ERR: CMT 2ND Boot CERT Mismatch done!July 26th 2014, 04:19 by yamaha49 » hello mga taga cebu.. July 26th 2014, 01:25 by mharrubio1616 » Nokia 1280 All solution here.July 18th 2014, 04:48 by crystalhawk » tanang taga davao.. oriental,del sur,norteJuly 13th 2014, 05:02 by Kaizer Opera» Gfive W1 mtk 6253 4 sim flash fileJuly 3rd 2014, 12:58 by ombanna » N70 no signal don sa jumper June 26th 2014, 12:13 by dhen72» update kolang mga cavite.....June 17th 2014, 03:24 by banico_25 » With Currency Exchange Rate (ex. peso to dollar conversation)June 5th 2014, 13:28 by *Lorgan» Lumia 710 vibrate ang hang done sa ATF..May 3rd 2014, 03:44 by banico_25 » Mabagal ba internet mo? Baka may virus ang pc mo, try mo 2February 24th 2014, 08:43 by gsmretorque» Visual Graphics Design : ModuleFebruary 15th 2014, 09:27 by loisnicoledz » n70 white screen hang done..>:D<February 11th 2014, 05:57 by jem19 » Samsung s5360t root and unlock....February 3rd 2014, 01:43 by CELLPHONE81 » GALAXY Y. TOUCH SCREEN PROBLEM.. DONE HAND RESET... LIVE VIDEO.. January 24th 2014, 13:43 by lhansvirgo83 » s5570 pattern attemps done....January 14th 2014, 09:46 by gsmretorque» Samsung E1080F BLINKING Done sa Z3X ...January 14th 2014, 09:25 by gsmretorque» NEED HELP C3-00 white screen after flashing sa ATFJanuary 6th 2014, 04:19 by rosin_93» samsung firmwares how to downloadDecember 13th 2013, 14:49 by treb719» samsung e2222 hang on logo done sa free softDecember 13th 2013, 01:00 by gsmretorque» Nokia 105 display light jumper solution without transistorsDecember 12th 2013, 05:25 by gsmretorque» Nokia 105 LCD Way And Display Light WayDecember 12th 2013, 02:15 by rosin_93» c1-01 no light doneDecember 5th 2013, 04:35 by gsmretorque» N70 keypad 4,back call ayaw mapindot done....December 3rd 2013, 04:08 by gsmretorque» boss need help nokia 301 ko po no power November 26th 2013, 14:02 by rosin_93» S3850 Samsung hang & auto-restart done by z3xNovember 24th 2013, 03:06 by gsmretorque» CHAPTER METRO MANILANovember 22nd 2013, 12:11 by brutal» JavaNovember 22nd 2013, 12:09 by brutal» MultiLoader v.5.65 .exe November 22nd 2013, 11:54 by brutal» HELP! samsung gt-b3410 rogers gprs/mms configurationNovember 6th 2013, 07:11 by click_king73 » mga boss 5230-1c unlockOctober 6th 2013, 10:59 by lemuel_06» samsung galaxy mini s5570October 1st 2013, 04:19 by habibislam » Samsung nexus i9023 auto on... Switch problem... Done sa tsamba...!September 17th 2013, 03:20 by jazzcho» e1100t no signal done with e2p resetSeptember 8th 2013, 21:46 by treb719» Motorola | Hard ware Solutions September 8th 2013, 09:33 by jazzcho» Galaxy s2 i9100 hang on samsumg logo done..!September 3rd 2013, 05:15 by ghandz_24» 5300 globe lock done sa z3x...!September 3rd 2013, 04:57 by ghandz_24» samsung b3210 hang on logo done sa freesoft...September 3rd 2013, 04:55 by ghandz_24» NOKIA ASHA 306 NOKIA LOGO ONLY THEN OFF...September 3rd 2013, 04:42 by ghandz_24» Nokia 1280 headset not detected done..!September 3rd 2013, 04:39 by ghandz_24» s5360 hang up done!!!August 27th 2013, 09:09 by ghandz_24» nokia c1-01 shorted done.....!August 27th 2013, 09:00 by ghandz_24 |
We’re Hiring toktok rider | |
|