Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
14th Dec Project1 v0.5
//gcc 5.4.0 #include <stdio.h> int main(void) { //----------------------------------------------------------------------------------- //Part 1-1 Draw Equitorial Triangle printf("----------------------------------------------------------\n Part 1-1\n"); printf(" *\n * *\n * * *\n* * * *\n"); //Part 1-2 Draws Square printf("Part 1-2\n* * * * *\n* * * * *\n* * * * *\n* * * * *\n* * * * *\n"); printf("----------------------------------------------------------\n Part 2\n"); //-------------------------------------------------------------- char CustomerName[100]; double Days; double costperDay; costperDay=30; double costofDays; double Miles; double costperMile; costperMile=.5; double costofMiles; double Gallons; double costperGallon; costperGallon=1.5; double costofGallons; double TotalRentalCost; printf("Enter\nCustomer name:\n Number of days:\n Number of miles:\n Number of gallons:\n------------------------------\n Total Rental Cost:$_______\n------------------------------\n"); scanf("%s%lf%lf%lf",&CustomerName,&Days,&Miles,&Gallons); costofDays=costperDay*Days; costofMiles=costperMile*Miles; costofGallons=costperGallon*Gallons; TotalRentalCost=costofDays+costofMiles+costofGallons; printf("Customer name:%s \n Num ber of days:%lf \n Number of miles:%lf \n Number of gallons:%lf \n------------------------------\n Total Rental Cost:$ %lf _______\n",CustomerName,Days,Gallons,Miles,TotalRentalCost); //Part 3 printf("----------------------------------------------------------------------\n Part 3\n"); double x; double xs; double xc; double a; double b; double c; double d; double y; printf("Enter:\na=\nb=\nc=\nd=\nx=\nF(x)=ax**3+bx**2+cx+d\n"); scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&x); printf("\n You Entered:\na=%lf\nb=%lf\nc=%lf\nd=%lf\nx=%lf \nF(x)=ax**3+bx**2+cx+d\n",a,b,c,d,x); xc=x*x*x; xs=x*x; y=a*xc+b*xs+c*x+d; printf("F(x)=%lfx**3+%lfx**2+%lfx+%lf\n",a,b,c,d); printf("F(2)=%lf",y); }
run
|
edit
|
history
|
help
0
Multiples of 10 sum
Factorial_LOOP
avance pregunta 2 guía 4 de módulo 3
Lab 6 v1
variable number of arguments 3
WAP in C to print the reverse of a string
18BCE2182 ASSESS_1 Q1-6
18BCE2182 ASSESS_1 Q1-1
p20
switch_nota