Hey guys, my program to find the middle number between 3 numbers from user, it is not so compact and advance, but i hope it helps someone in their level of study, i have the code in C language as well as in the QBASIC language, please tell me if you like the logic and please tell me if you find any bug in it ,

C Program:

#include<stdio.h>

void main()

{

int a, b, c, d;

scanf("%d%d%d",&a,&b,&c);

if (a>b&&a<c||a<b&&a>c)

{

printf("%d is the middle number.",a);

}

else if (b<a&&b>c||b>a&&b<c)

{

printf("%d is the middle number",b);

}

else

printf("%d is the middle number.",c);

}

QBASIC syntax:

CLS

INPUT "Enter three numbers: "; a

INPUT "Enter annother number: "; b

INPUT "Enter another number: "; c

IF a < b AND a > c OR a > b AND a < c THEN

PRINT a; "is the middle number.";

ELSEIF b > a AND b < c OR b < a AND b > c THEN

PRINT b; "is the middle number."

ELSE

PRINT c; "is the middle number."

END IF

END

Thank you :)

Sep 13, 2017
by
Unicodist
Hey guys! check this code out, it will take input in any number system and can convert it to any number system, This is made by me, however, you can not use any number system that has base more than 10 because it doesn't support alphabets as numbers, but in next update, i will fix that too, please see this code and give me feedback what do you think about the code and please tell me if you find any bugs/errors. :)

#include<stdio.h>

#include<math.h>

void main()

{

int inpt, outpt=0, inbase, outbase, i=0, ind=0, rem, mul=1;

printf("Enter the input base: (Not more than 10)");

scanf("%d",&inbase);

printf("\nEnter the output base: (Not more than 10)");

scanf("%d",&outbase);

printf("\nEnter the number you want to convert: ");

scanf("%d",&inpt);

while (inpt)

{

rem=inpt%10;

inpt/=10;

ind+=(rem*pow(inbase,i));

i++;

}

while (ind)

{

rem=ind%outbase;

ind/=outbase;

outpt=outpt+rem*mul;

mul*=10;

}

printf("\nThe equivalent number is: %d\n",outpt);

}

Sep 11, 2017
by
Unicodist