balesh darapollu


{ City } hyderabad
< Country > india
* Profession * embedded engineer
User No # 109205
Total Questions Posted # 2
Total Answers Posted # 2

Total Answers Posted for My Questions # 1
Total Views for My Questions # 6236

Users Marked my Answers as Correct # 8
Users Marked my Answers as Wrong # 6
Questions / { balesh darapollu }
Questions Answers Category Views Company eMail

Program to swap the any two elements in an array containing N number of elements?

Bosch, Glenwood, Ugam Solutions,

1 C 4980

How can to check the working of a sensor deployed in a project?

CMC,

Embedded Systems AllOther 1256




Answers / { balesh darapollu }

Question { Philips, 2262 }

write a c code "if you give a any decimal number then print that number in english alphabet"?

ex: i/p: 552
o/p: five hundred fifty two ...


Answer

#include
void main()
{
int number,i=0,j,digit;
char * word[1000];
printf("Enter number
");
scanf("%d",&number);
while(number){

digit = number %10;
number = number /10;

switch(digit){
case 0: word[i++] = "zero"; break;
case 1: word[i++] = "one"; break;
case 2: word[i++] = "two"; break;
case 3: word[i++] = "three"; break;
case 4: word[i++] = "four"; break;
case 5: word[i++] = "five"; break;
case 6: word[i++] = "six"; break;
case 7: word[i++] = "seven"; break;
case 8: word[i++] = "eight"; break;
case 9: word[i++] = "nine"; break;

}
}

for(j=i-1;j>=0;j--){
printf("%s ",word[j]);
}
}

Is This Answer Correct ?    1 Yes 5 No

Question { Bosch, 4980 }

Program to swap the any two elements in an array containing N number of elements?


Answer

#include

void swaparray(int *,int *);
void main()
{
int n,num[10],i,element,k,l;

printf("Enter number of elements
");
scanf("%d",&n);
printf("Enter the elements
");
for(i=0;i {
scanf("%d",&element);
num[i]=element;
}
printf("Original array
");
for(i=0;i printf("num[%d]=%d
",i,num[i]);
printf("ENter places to be swapped");
scanf("%d%d",&k,&l);
swaparray(num+k,num+l);
printf("AFTER SWAPPING
");
for(i=0;i printf("num[%d]=%d
",i,num[i]);
}
void swaparray(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}

Is This Answer Correct ?    7 Yes 1 No