info@sislbd.com +8801775 012 358

Blog

November 25, 2017

#include <stdio.h> int main() { int number,store,i,totalbricks,moves_bricks,set=0,avg; while(scanf(“%d”, &number) && number) { totalbricks=0; moves_bricks=0; set +=1; for(i=0;i<number;i++) { scanf(“%d”, &store); totalbricks += store; } // End of for avg=totalbricks/number; for(i=0;i<number;i++) if(avg > store) moves_bricks +=avg-store; printf(“Set #%d\n”,set); printf(“The minimum number of moves is %d.\n”,moves_bricks); printf(“\n”); } // End of while } // End of main

November 25, 2017

#include <stdio.h> int main() { int C,N,numbers,i,totalnumber,count; float avg,abovestudent; scanf(“%d”, &C); while(C >= 1) { scanf(“%d”, &N); totalnumber=0; for(i=0;i<N;i++) { scanf(“%d”, &numbers); totalnumber += numbers; } // End of for avg=(float)totalnumber/N; count=0; for(i=0;i<N;i++) if(avg < numbers) count += 1; abovestudent =(float)count*100/N; printf(“%.3f%c\n”,abovestudent,37); C -=1; }// End of while } // End of main

November 25, 2017

#include <stdio.h> int main() { int T,a,b,i,sum,j; scanf(“%d”, &T); j=1; while(T > 0) { sum=0; scanf(“%d%d”,&a,&b); for(i=a;i<=b;i++) { if(i%2!=0) sum +=i; } // End of for printf(“Case %d: %d\n”,j,sum); j +=1; T -=1; } // End of while } // End of main

November 25, 2017

#include <stdio.h> #include <string.h> int main() { char number; long Length,mul,pow,sum=0,number1,power; while(1) { scanf(“%s”,number); Length=strlen(number); if(Length==1 && number==48) break; else { power=Length; for(long i=0;i<Length;i++) { pow=1; for(long j=48;j<=57;j++) { if(j==number) { number1=j-48; break; }//End of if }//End of inner for for(long i1=1;i1<=power;i1++) pow=pow*2; mul=pow-1; sum=sum+number1*mul; power=power-1; }//End of outer for printf(“%d\n”,sum); }//End of els sum=0;