Skip to main content

URI 1005 - Average 1

Solution :


#include<stdio.h>
int main()
{
float a,b,result;
scanf("%f %f",&a,&b);
result=((a*3.5)+(b*7.5))/(3.5+7.5);
printf("MEDIA = %.5f\n",result);
return 0;
}

Comments

Popular posts from this blog

Shamim Sir Lap Report 2

1) WAP to accept any character from user and display its ASCII number on  screen. Ans: #include<stdio.h> void main() { char s; printf("Input the character here: "); scanf("%c",&s); printf("The ASCII of this Character: %d",s); } 2) WAP to input any ASCII number and display appropriate character on screen. Ans: #include<stdio.h> void main() { int s; printf("Input the ASCII number here: "); scanf("%d",&s); printf("The Character of ASCII:%c",s); } 3) WAP to input any Capital letter and display it with small letter. Ans: #include<stdio.h> void main() { char s; printf("Enter the Capital letter here :"); scanf("%c",&s); printf("the small letter is: %c", s+32); } 4) WAP to input any Small letter and display it with capital letter. Ans: #include<stdio.h> void main() { char s...

Let's Do It Again(long contest) || solve

A - Boys & Girls #include <stdio.h> int main() { int n, m, a, b, k = 0, l = 0; scanf("%d %d",&n,&m); while (n--) { scanf("%d %d",&a,&b); k=k+a; l=l+b; } printf("%d\n",(k+m-1)/m+(l+m-1)/m); return 0; } B - Conversion #include<stdio.h> int main() {     int n,s,o,u;     scanf("%d",&n);     s=n/10;     o=(n/100)*10+(n%10);     u=n%100;     if(u==0)     {             printf("%d\n",s);     }     else if(u>0&&u<10)     {     if(s<o)         printf("%d\n",s);         else         printf("%d\n",o);     }     else if(s==o&&u>s)         printf("%d\n",s);     else if(s==o&&u<s)   ...

URI Online Judge | 1001

Extremely Basic Read 2 variables, named  A  and  B  and make the sum of these two variables, assigning its result to the variable  X . Print  X  as shown below. Print endline after the result otherwise you will get “ Presentation Error ”. Input The input file will contain 2 integer numbers. Output Print the letter  X  (uppercase) with a blank space before and after the equal signal followed by the value of X, according to the following example. Obs.: don't forget the endline after all. Samples Input Samples Output 10 9 X = 19 -10 4 X = -6 ANS: #include<stdio.h> int main() { int A,B,X; scanf("%d %d",&A,&B); X=A+B; printf("X = %d\n",X); return 0; }