CrazyEngineers
  • Program for Ramanujan Numbers?

    Sagar Bhattacharya

    Sagar Bhattacharya

    @sagar-xdCxNW
    Updated: Oct 26, 2024
    Views: 1.3K

    what is wrong in the following code 

    output:- 1729 4101 4913 {correct output 1729 4104}

    #include <stdio.h>

    int main(){

    int i,d=0,j,k,s=5000;

    for(i=1;i<=s;i++){

      for(j=1;j<i;j++){

          for(k=1;k<i;k++){

                    if((j*j*j)+(k*k*k)==i&&k>j)

           d++;

                       }

    }

    if(d==2)

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

      d=0;

      }

    }

    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Home Channels Search Login Register