Skip to main content

Day 1

/* This program will convert meters to miles */
#include <stdio.h>
#include <math.h>
int main(void) {
/* Declare and initialize variables. */
double x1=0.00062137, y1=5000, converter, meters, miles;
/* Compute sides of a right triangle. */
converter =x1;
meters =y1;
miles = (converter*meters);
/* Print distance. */
printf("The distance in miles is "
"%5.2f \n",miles);
return 0;
}


/* This program will convert degrees Celcius to degrees Rankine */
#include <stdio.h>
#include <math.h>
int main(void) {
/* Declare and initialize variables. */
double x1=273.15, x2=0, y1=1.8, converter, celcius,mul,rankine;
/* Compute degrees Renkine. */
converter =x1;
celcius =x2;
mul=y1;
rankine =((converter+celcius)*(mul));
/* Print distance. */
printf("The temperature in rankine is "
"%5.2f \n",rankine);
return 0;
}


/* This program will find the area of an ellips with */
/*semi axis a and b*/
#include <stdio.h>
#include <math.h>
int main(void) {
/* Declare and initialize variables. */
double a1=2, b1=3, Pi=3.14159265359, radi_1, radi_2,y, area ;
/* Compute degrees Renkine. */
radi_1=a1;
radi_2=b1;
y=Pi;
area =((radi_1*radi_2*y));
/* Print distance. */
printf("The are of the ellpise is "
"%5.2f \n",area);
return 0;
}


/* This program will find the area of a sector with */
/*radius r and angle theta*/
#include <stdio.h>
#include <math.h>
int main(void) {
/* Declare and initialize variables. */
double r1=2,b1=360 , d1=5,Pi=3.14159265359, radi_1, angle,y, area ;
/* Compute degrees Renkine. */
radi_1=r1;
angle=d1;
area =(((radi_1*radi_1)*(Pi)*(angle/b1)));
/* Print distance. */
printf("The area of the arc of the ellpise is "
"%5.2f \n",area);
return 0;
}

Comments

Popular posts from this blog

DAY 4 HW

1. jet modifications /* This program estimates new velocity and */ /* acceleration values for a specified time. */ #include < stdio.h > #include < math.h > int main( void ) { /* Declare variables. */ double itime, velocity, acceleration; /* Get time value from the keyboard. */ printf( "Enter new time value in minutes: \n" ); scanf( "%lf" ,&itime); /* Compute velocity and acceleration. */ velocity = 0.00001 *pow(itime* 60 , 3 ) - 0.00488 *pow(itime* 60 , 2 ) + 0.75795 *(itime* 60 ) + 181.3566 ; acceleration = 3 - 0.000062 *velocity*velocity; /* Print velocity and acceleration. */ printf( "Velocity = %8.3f m/s \n" ,velocity); printf( "Acceleration = %8.3f m/sˆ2 \n" ,acceleration); /* Exit program. */ return 0 ; } 2 Log base 2 #include < stdio.h > #include < math.h > int main( void ) { /* Declare variables. */ double number, value; /* Get time val...

DAY 4 lab

/* This program is to switch on and off led light*/ const int BLED=9; //Blue LED on Pin 9 const int GLED=10; //Green LED on Pin 10 const int RLED=11; //Red LED on Pin 11 const int BUTTON=2; //The Button is connected to pin 2 boolean lastButton = LOW; //Last Button State boolean currentButton = LOW; //Current Button State int ledMode = 0; //Cycle between LED states void setup() {  pinMode (BLED, OUTPUT); //Set Blue LED as Output  pinMode (GLED, OUTPUT); //Set Green LED as Output  pinMode (RLED, OUTPUT); //Set Red LED as Output  pinMode (BUTTON, INPUT); //Set button as input (not required) } /* * Debouncing Function Pass it the previous button state, * and get back the current debounced button state. */ boolean debounce(boolean last) {  boolean current = digitalRead(BUTTON); //Read the button state  if (last != current) //if it's different...  {  delay(5); //wait 5ms  current = digitalRead(BUTTON); //read it again ...

Day 2

1. inches to feet /* This program will estimate height of person */ /* based on femur and humerus length */ #include < stdio.h > #include < math.h > int main( void ) { /* Declare variables. */ double femur, femur_ht_f, femur_ht_m, humerus, humerus_ht_f, humerus_ht_m, femf,humf,femm,humm; /* Get user input from the keyboard. */ printf( "Enter Values in Inches. \n" ); printf( "Enter femur length: \n" ); scanf( "%lf" ,&femur); printf( "Enter humerus length: \n" ); scanf( "%lf" ,&humerus); /* Compute height estimates. */ femur_ht_f = femur* 1.94 + 28.7 ; femur_ht_m = femur* 1.88 + 32 ; humerus_ht_f = humerus* 2.8 + 28.2 ; humerus_ht_m = humerus* 2.9 + 27.9 ; femf=(femur_ht_f/ 12 ); femm=(femur_ht_m/ 12 ); humf=(humerus_ht_f/ 12 ); humm=(humerus_ht_m/ 12 ); /* Print height estimates. */ printf( "\nHeight Estimates in Feet \n" ); printf( "Femur F...