Pages

Showing posts with label SUM. Show all posts
Showing posts with label SUM. Show all posts

Wednesday, October 20, 2010

SUM

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

void main()
{
    int m, a, sum;

    clrscr();
    printf("\n\tEnter the value of m:^");
    scanf("%d",&m);
    printf("\n\tEnter the value of a:^");
    scanf("%d",&a);

    sum =m+a;

    if(sum>=0)
        printf("\n\t\tThe sum of %d and %d = %d",m,a,sum);
    getch();
}

DIFFERENCE & QUOTIENT

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

void main()
{
    float u,p,diff;
    float quo;

    clrscr();
    printf("\n\tType the value of u:^");
    scanf("%f",&u);
    printf("\n\tType the value of p:^");
    scanf("%f",&p);

    if(u>p)
    {
        diff =u-p;
        quo =u/p;

        printf("\n\n\t%.0f - %.0f = %.0f",u,p,diff);
        printf("\n\n\t%.0f / %.0f = %.1f",u,p,quo);
    }
    getch();
}