diff --git a/Contests/codechef solutions/Chef_Diet.cpp b/Contests/codechef solutions/Chef_Diet.cpp new file mode 100644 index 0000000..8c2e551 --- /dev/null +++ b/Contests/codechef solutions/Chef_Diet.cpp @@ -0,0 +1,35 @@ +// Problem Link : https://www.codechef.com/problems/DIET + +#include +using namespace std; + +int main() { + // your code goes here + int T,N,i,flag; + long K; + cin>>T; + while(T--) + { + cin>>N>>K; + long A[N],Sum; + // Used Sum variable here to represent left over from previous iteration + Sum=0; + for(i=1;i<=N;i++) + cin>>A[i]; + for(i=1;i<=N;i++) + { + flag=0; + if((Sum+A[i]) +using namespace std; +int main() +{ + int n; + cout<<"Enter the size of array : "; + cin>>n; + int a[n],i,average; + float sum=0; + cout<<"Enter array elements : \n"; + for(i=0;i>a[i]; + for(i=0;i +using namespace std; +int main() +{ + int r,i,j,k; + cout<<"Enter no. of rows after which u want to mirror image below of above : "; + cin>>r; + cout<<"Diamond Pattern : \n"; + for(i=1;i<=r;i++) + { + for(j=1;j<=r-i;j++) + cout<<" "; + for(k=1;k<=((2*i)-1);k++) + cout<<"*"; + cout<<"\n"; + } + for(i=1;i +using namespace std; +int main() +{ + int r,c,i,j; + cout<<"Enter rows : "; + cin>>r; + cout<<"Enter columns : "; + cin>>c; + int A[r][c],B[c][r]; + cout<<"Enter matrix elements : \n"; + for(i=0;i>A[i][j]; + } + cout<<"Matrix A : \n"; + for(i=0;i