תוכנית שפת C
Question:

כתוב תוכנית שקולטת  4 מספרים שלמים A,B,C,D,  ומדפיסה את הממוצע  הגדול ביותר של זוג מספרים שלמים

0 People tried to answer this question
Answer:



Comments:
1.  shalata mohammed (24.11.2016 am 02.18.55)
תשובה על שאלה מ מוחמד שלאעטה

#include<stdio.h>

void main()

{

int A,B,C,D;

printf("give me 4 numbers");

scanf("%d",&A);

scanf("%d",&B);

scanf("%d",&C);

scanf("%d",&D);

if(A>B && A>C && A>D)

{

if(B>C && B>D)

{

printf(" the number is ");

printf("%d", (A+B)/2);

}

else

if(C>B && C> D)

{

printf(" the number is ");

printf("%d", (A+C)/2);

}

else

{

printf(" the number is ");

printf("%d", (A+D)/2);

}

}

else

if(B>A && B>C && B>D)

{

if(A>C && A>D)

{

printf(" the number is ");

printf("%d", (A+B)/2);

}

else if(C>A && C> D)

{

printf(" the number is ");

printf("%d", (B+C)/2);

}

else

{

printf(" the number is ");

printf("%d", (B+D)/2);

}

}

else

if(C>B && C>A && C>D)

{

if(A>B && A>D)

{

printf(" the number is ");

printf("%d", (A+C)/2);

}

else if(B>A && B> D)

{

printf(" the number is ");

printf("%d", (B+C)/2);

}

else

{

printf(" the number is ");

printf("%d", (C+D)/2);

}

}

else

if(D>A && D>B && D>C)

{

if(B>C && B>A)

{

printf(" the number is ");

printf("%d", (B+D)/2);

}

else

if(C>B && C> A)

{

printf(" the number is ");

printf("%d", (D+C)/2);

}

else

{

printf(" the number is ");

printf("%d", (A+D)/2);

}

}

}



History of edits
More Interactive Questions that might interest you In Computer