Pages

Thursday, October 21, 2010

DISTANCE

The formula to compute a work exerted is given as: DISTANCE * FORCE
Where: DISTANCE of two points is P2-P1.
Input the values of two points and the force.
Print the work exerted.

#include<stdio.h>
#include<conio.h>

int main(void)
{
    int p1,p2,f,d,work_ex;

    clrscr();
    printf("\n\tPlease enter the first point:");
    scanf("%d",&p1);
    printf("\n\tPlease enter the second point:");
    scanf("%d",&p2);
    printf("\n\tPlease enter the force exerted:");
    scanf("%d",&f);

    d =p2-p1;
    work_ex =f*d;

    printf("\n\n\n\tThe work exerted is %d",work_ex);
    getch();
}

No comments:

Post a Comment