HTC Global Services Interview Question for Software Developers


Country: India
Interview Type: Written Test




Comment hidden because of low score. Click to expand.
1
of 1 vote

public static int reverse(int n)
    {
        int res = 0;
        while(n > 0)
        {
            int digit = n % 10;
            res = res * 10 + digit;
            n /= 10;
        }
        return res;
    }

     public static void main(String []args){
        System.out.println(reverse(78421));//12487
     }

- bogdan.zima October 05, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

// ZoomBA
str_of_n = str( n ) // convert a num into string 
str_of_n ** -1  // reverse a string

- NoOne October 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

reverse()
int a,b;
scanf("%d"&a);
while(a>0)
{
b=a%10;
printf("%d",b);
a=a/10;
}

- abhishek.kr.met16@itbhu.ac.in July 20, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class ReverseDigitPrint {

public static void main(String[] args) {
printReverse(391, -1);
}

public static void printReverse(int digit, int reminder) {
if (digit <= 0) {
return;
}
reminder = digit % 10;
if (reminder != -1) {
System.out.print(reminder);
}
digit = digit / 10;
printReverse(digit, reminder);
}
}

- Shekhar Saxena October 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class ReverseDigitPrint {

public static void main(String[] args) {
printReverse(391, -1);
}

public static void printReverse(int digit, int reminder) {
if (digit <= 0) {
return;
}
reminder = digit % 10;
if (reminder != -1) {
System.out.print(reminder);
}
digit = digit / 10;
printReverse(digit, reminder);
}
}

- tech.shekharsaxena October 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<stdio.h>
#include<conio.h>
void main()
{
int n,a;
scanf("%d",&n);
while(n!=0)
{
a=n%10;
printf("%d",a);
n=n/10;
}
getch();
}

- Anonymous March 13, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<stdio.h>
#include<math.h>
void main()
{
int i, num, lolo, revNum=0, revBit=0;
printf("Please enter a number: ");
scanf("%d", &num);
printf ("The number you have entered is : %d\n", num);

lolo=(int)log10(num);
printf("Value of log(%d)=%d\n", num, lolo);
for (i=0;i<lolo; i++)
{
revBit=num%10;
num=num/10;
revNum*=10;
revNum+=revBit;
}
printf("The reversed number is :%d\n", revNum);
}

- Anonymous November 08, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<stdio.h>
#include<math.h>
void main()
{
        int i, num, lolo, revNum=0, revBit=0;
        printf("Please enter a number: ");
        scanf("%d", &num);
        printf ("The number you have entered is : %d\n", num);

        lolo=(int)log10(num);
        printf("Value of log(%d)=%d\n", num, lolo);
        for (i=0;i<lolo; i++)
        {
                revBit=num%10;
                num=num/10;
                revNum*=10;
                revNum+=revBit;
        }
        printf("The reversed number is :%d\n", revNum);
}

- Anonymous November 08, 2018 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More