uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

Cube_Sphere.c (680B)


      1 #include <stdio.h>
      2 #include <math.h>
      3 
      4 int main(int argc, char **argv)
      5 {
      6     double length, rad, area_cube, vol_cube, area_sphere, vol_sphere;
      7     const double PI = 3.14;
      8 
      9     printf("Μήκος (σε μέτρα): ");
     10     scanf("%lf", &length);
     11 
     12     area_cube = 6.0*pow(length, 2);
     13     vol_cube = pow(length, 3);
     14     rad = length;
     15     area_sphere = 4.0*PI*pow(rad, 2);
     16     vol_sphere = (4.0/3.0)*PI*pow(rad, 3);
     17 
     18     printf("Εμβαδόν κύβου: %.2lf\n", area_cube);
     19     printf("Όγκος Κύβου: %.2lf\n\n", vol_cube);
     20     printf("Εμβαδόν σφαίρας: %.2lf\n", area_sphere);
     21     printf("Όγκος σφαίρας: %.2lf\n", vol_sphere);
     22     
     23     return 0;
     24 }