We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<stdio.h>intmain(){intn,d,m,i,c=0,sum=0,j;printf("Please inter number of bars in chocolate: ");scanf("%d",&n);inta[n];printf("Input numbers on each of the squares of chocolate\n");for(i=0;i<n;i++){scanf("%d",&a[i]);}printf("Ron's birth day and month :");scanf("%d %d",&d,&m);for(i=0;i<n;i++){for(j=i;j<(i+m);j++){sum=sum+a[j];}if(sum==d){c++;}sum=0;}printf("%d",c);}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division
You are viewing a single comment's thread. Return to all comments →
My code in c language