Friday 11 March 2022

C Program To Calculate Force of Attraction exerted by Earth on a Body Using a FUNCTION

 CALCULATE FORCE


Code :


#include<stdio.h>

float force(float mass);

int main()
{
    float force_val, m;
       
       
    printf("\tCALCULATE FORCE EXERTED BY EARTH\n");
    printf("------------------------------------------------\n");
    printf("Enter mass of the body in kgs : ");
    scanf("%f", &m);
   
    force_val = force(m);
   
    printf("\nThe value of Force in Newton is %.2f\n\n", force_val);
    printf("************************************************\n");
    return 0;
}

float force(float mass)
{
   float result;
   result = mass * 9.8;
   return result;
}


Come again Learn again !

« iCodeBuzz »


No comments:

Post a Comment