Problem 13

7 comments on “Problem 13”


  • Raman

    // Online C compiler to run C program online
    #include

    int main() {
    int n,rem,c=0,i=0;
    int a[20];
    scanf(“%d”,&n);
    while(n>0){
    rem=n%10;
    a[i]=rem;
    n=n/10;
    i++;
    c++;
    }
    for(i=0;i<c;i++){
    printf("%d",a[i]);
    }

    return 0;
    }


  • Richik

    PYTHON 3:
    k=0
    i=0
    def rev(n):
    global k
    global i
    if n==0:
    return
    else:
    rev(n//10)
    k+=(n%10)*10**i
    i+=1
    rev(int(input()))
    print(k)


  • Harsha

    def reverse(n):
    str_n=str(n)
    if n<0:
    str_n=str_n[1:]
    str_n=str_n[::-1]
    str_n='-'+str_n
    else:
    str_n=str_n[::-1]
    return int(str_n)
    n=int(input())
    print(reverse(n))


  • avi gehlot

    #python code here
    number =int(input())
    reverse=0
    while number>0:
    remainder=number%10
    reverse=reverse*10+remainder
    number=number//10
    print(reverse)