---
# System prepended metadata

title: c021 用do while算總分
tags: [c]

---

# c021 用do while算總分
###### tags: `c`
![](https://hackmd.io/_uploads/BJBhdM7I3.png)


---
#include<iostream>
using namespace std;
                    //do while算總分
main(){
	int n=0,sum=0;
	do{
	sum=sum+n;
	cout<<"輸入成績:-1結束"<<endl;
	cin>>n;
	
	}while(n!=-1);
	
	cout<<"總分為:"<<sum; 
 return 0;
}