Guest User

Untitled

a guest
Jun 18th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7.     int i=0,input=0;
  8.  
  9.     int threecount=0,sevencount=0,ninecount=0,totalcount=0,totalnumber=0;
  10.  
  11.     cout<<"Please input positive integers seperated by spaces and input a negative number when complete \n";
  12.     cin>>input;
  13.     while (input>=0)
  14.     {
  15.             if (input==3){
  16.                     threecount++;}
  17.             if (input==7){
  18.                     sevencount++;}
  19.             if (input==9){
  20.                     ninecount++;}
  21.             totalcount++;
  22.             cin>>input;
  23.     }
  24.  
  25.     cout<<"There are "<<threecount<<" 3s in the set of numbers \n";
  26.     cout<<"There are "<<sevencount<<" 7s in the set of numbers \n";
  27.     cout<<"There are "<<ninecount<<" 9s in the set of numbers \n";
  28.     cout<<"There are "<<totalcount<<" numbers in the set of numbers";
  29. }
Add Comment
Please, Sign In to add comment