Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * teszt.c
  3.  *
  4.  *  Created on: 2012.08.12.
  5.  *      Author: kriszti
  6.  */
  7.  
  8. #include <stdio.h>
  9.  
  10. int main(){
  11.  
  12.         int input=0;
  13.         int sum = 0;
  14.         float avg = 0;
  15.         int temp = 0;
  16.  
  17. while (input != 0){
  18.          printf("Kerek egy szamot\n");
  19.          scanf("%d\n", &input);
  20.          sum = sum + input;
  21.          temp = temp + 1;
  22.          printf("Az osszeg: %d \n", sum);
  23.          avg = sum / temp;
  24.          printf("Az atlag: %f \n", avg);
  25. }
  26.  
  27.  
  28.         return 0;
  29. }