Ad Code

Responsive Advertisement

1150 - Exceeding Z

Author: Ismail Hosen

Daffodil International University





Problem Link

//Please follow from main function



#include<stdio.h>


int main(){


  int i, x, z,count=0, sum=0;


  scanf("%d", &x);


  while(1){


    scanf("%d", &z);


    if(z>x){


      break;


    }


  }


  for(i=x; i<=z; i++){


    count++;


    sum=sum+i;


    if(sum>z){


      break;


    }


  }


  printf("%d\n", count);





  return 0;


}





Post a Comment

0 Comments