Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

TCS Coding Problem 9

4 comments on “TCS Coding Problem 9”


  • Gopika Gopal

    #include
    int convert(int);
    void main()
    {
    int dnum;
    scanf(“%d”,&dnum);
    printf(“%d”,convert(dnum));
    }
    int convert(int dnum)
    {
    int onum=0,i=1;
    while(dnum!=0)
    {
    onum=onum+(dnum%8)*i;
    dnum=dnum/8;
    i=i*10;
    }
    return onum;
    }


  • Mohd Saif

    x=int(input(“how many times you want to convert a decimal number into equivalent octal number:\n”))
    for i in range(x):
    n=int(input(“enter the decimal number:\n”))
    print(“Its equivalent octal number is:”,oct(n),”starting first two symbol of octal i.e zero and o”)