Advertisement
matheusscorrea

Untitled

May 6th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int opcao, i;
  6.     double x, soma;
  7.     do
  8.     {
  9.         i=0;
  10.         soma=0.0;
  11.         while (i<2)
  12.         {
  13.             scanf("%ld", &x);
  14.             if(x>=0.0 && x<=10.0)
  15.             {
  16.                 soma+=x;
  17.                 ++i;
  18.             }
  19.             else
  20.             {
  21.                 printf("nota invalida\n");
  22.             }
  23.         }
  24.         printf("media = %.2lf\n", soma/2.0);
  25.  
  26.         do{
  27.             printf("novo calculo (1-sim 2-nao)\n");
  28.             scanf("%d", &opcao);
  29.         }while(opcao<1 || opcao>22);
  30.  
  31.     }while(opcao!=2);
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement