Advertisement
Gireada

Tema 8 info

Nov 19th, 2012
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. II
  2. 2.
  3. #include<iostream.h>
  4. #include<conio.h>
  5.  
  6. int main()
  7. {float b,c,d,e,f,g;
  8. unsigned a;
  9. cout<<"Cate materii ai";cin>>a;
  10. b=0;c=0;e=0;d=0;f=0;
  11. while(b!=a)
  12. {
  13.            g=c;
  14.            cout<<"Scrie nota";cin>>c;
  15.            d+=c;
  16.            if(c>g)
  17.            {
  18.                   f=c;
  19.            }
  20.            b++;
  21. }
  22. e=d/a;
  23. cout<<float(e)<<endl;
  24. cout<<f;  
  25. getch();
  26. }
  27. 3.
  28. #include <iostream.h>
  29. #include <conio.h>
  30.  
  31. int main()
  32. {unsigned a,b,c,d,e;
  33. c=0;e=0;
  34. a=32;
  35. cout<<"Introdu n:";cin>>d;
  36. while(c!=d)
  37. {
  38.            cout<<"Introdu numarul:";cin>>b;
  39.            if(b%3==0)
  40.            {
  41.                     cout<<"\nNumarul este prim:";
  42.                     cout<<b<<endl;
  43.                     e+=1;
  44.            }
  45.            else if(b%3!=0)
  46.            {
  47.                 cout<<"\nNumar neprim:";
  48.                 cout<<b<<endl;
  49.            }
  50.            c++;      
  51. }
  52. cout<<"\nNumere prime:"<<e;
  53. getch();
  54.  
  55. }
  56.  
  57.  
  58.  
  59. Daca o sa le fac si pe celelalte va anunt.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement