Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int i=0,input=0;
- int threecount=0,sevencount=0,ninecount=0,totalcount=0,totalnumber=0;
- cout<<"Please input positive integers seperated by spaces and input a negative number when complete \n";
- cin>>input;
- while (input>=0)
- {
- if (input==3){
- threecount++;}
- if (input==7){
- sevencount++;}
- if (input==9){
- ninecount++;}
- totalcount++;
- cin>>input;
- }
- cout<<"There are "<<threecount<<" 3s in the set of numbers \n";
- cout<<"There are "<<sevencount<<" 7s in the set of numbers \n";
- cout<<"There are "<<ninecount<<" 9s in the set of numbers \n";
- cout<<"There are "<<totalcount<<" numbers in the set of numbers";
- }
Add Comment
Please, Sign In to add comment