Reginaldojs

exercicio 45,lista 3

Jun 15th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main() {
  4.     int n, par=0,mediap,somap=0,resp;
  5.     printf("\t\t\tdigite varios valores:\n");
  6.     do{
  7.               printf("\t\t\t\t");
  8.               scanf("%d",&n);
  9.               if(n==0)
  10.               break;
  11.               if(n%2==0){
  12.                    par=par+1;
  13.                    somap=somap+n;
  14.                    }
  15.     }
  16.     while(resp!=0);
  17.     mediap=somap/par;
  18.     printf("\n \tTemos %d numeros pares,e a media deles equivale a %d\n\n\t\t",par,mediap);
  19.     system("pause");
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment