ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
convert 12345 to 54321 withoutusing strig
 Question Submitted By :: Krtraj
I also faced this Question!!     Rank Answer Posted By  
 
  Re: convert 12345 to 54321 withoutusing strig
Answer
# 1
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
printf("enter a number");
scanf("%d",&i);
for(int n=1;n<=5;n++)
{
j=i%10;
i=i/10;
printf("%d",j);
}
getch();
}
 
Is This Answer Correct ?    2 Yes 3 No
Satrughna Sethi
 
  Re: convert 12345 to 54321 withoutusing strig
Answer
# 2
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
printf("enter a number");
scanf("%d",&i);
for(int n=1;n<=5;n++)
{
j=i%10;
i=i/10;
printf("%d",j);
}
getch();
}
 
Is This Answer Correct ?    2 Yes 1 No
Abhradeep Chatterjee
 
 
 
  Re: convert 12345 to 54321 withoutusing strig
Answer
# 3
void main()
{
	int num, temp;
	for(;;) {
		printf("Enter number:");
		scanf("%d",&num);
		if(num == 0) break;
		while(num) {
			temp = num%10;
			num = num/10;
			printf("%d", temp);
		}
		printf("\n");
	}
        getche();
}
So any number will be reversed here. 12345 is five digit
number. Using while we can generalize the number of digits.
The continuous loop is ended when 0 is entered.
 
Is This Answer Correct ?    1 Yes 0 No
Mani Bhowmik
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Give the output for the following program. #define STYLE1 char main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %d\n",x,y); } ADITI1
what is Structural oriented language? give some example of this language.....?  1
size maximum allocated by calloc() DELL1
HOW DO YOU HANDLE EXCEPTIONS IN C? AppLabs2
plz answer..... a program that reads non-negative integer and computes and prints its factorial  2
How can I invoke another program from within a C program?  6
related to rdbms query .  1
write a c program to print a given number as odd or even without using loop statements,(no if ,while etc)  4
plz answer.. a program that takes a string e.g. "345" and returns integer 345  3
why you will give me a job in TCS. TCS5
How to receive strings with spaces in scanf()  4
which type of question asked from c / c++ in interview.  2
How to convert a binary number to Hexa decimal number?? (Note:Do not convert it into binary and to Hexadecimal) Subex1
what is difference between ++(*p) and (*p)++ Accenture15
What are the commands should be given before weiting C Program i.e, Cd.. like Infonet3
int a=1,b=2,c=3; printf("%d,%d",a,b,c); What is the output? Verifone14
how can i get output like this? 1 2 3 4 5 6 Excel3
How to swap two values using a single variable ? condition: Not to use Array and Pointer ?  4
f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } what is the value of 'a' printed  4
If we give two names then this displays the connection between the two people. It is nothing but flames game  1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com