Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int m, n;
cin>>m>>n;
int rem = m % n;
for(int i = 0; i < (n - rem); i++){
cout<<(m/n)<<" ";
}
for(int i = 0; i < rem; i++){
cout<<(m/n + 1)<<" ";
}
cout<<endl;
return 0;
}
Copy The Code &
Try With Live Editor
Input
12 3
Output
4 4 4
Demonstration
Codeforcess Solution 306-A A. Candies ,C++, Java, Js and Python,306-A,Codeforcess Solution