Tuesday 8 August 2017

code for checking smaller and larger no

#include"stdio.h"
#include"conio.h"
int n,large,small;
void main()
{
    printf("Enter a number\n");
    scanf("%d",&n);
    large=n;
    small=n;
    while(n != 0)
    {
        printf("Enter a number\n");
        scanf("%d",&n);
        if(n>large)
            large=n;
        else if(n<small)
            small=n;
    }
    printf("Large number is %d \n Small number is %d",large,small);
    getch();
}

0 comments: