Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- double x, soma=0, contador=0, ok=1;
- double media;
- int casa;
- char c;
- while(1){
- scanf("%lf", &x);
- soma=soma+x;
- contador++;
- scanf("%c", &c);
- if(c=='\n') break;
- }
- media=soma/contador;
- casa=soma/contador;
- if(media-(int)media>=0.5){
- casa=(soma/contador)+1;
- printf("%d", casa);
- }
- else if(media-(int)media<0.5){
- printf("%d", casa);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment