ALLInterview.com :: Home Page Forum9.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   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories >> Software >> Programming-Languages
 
  C (629)  C++ (421)  Delphi (507)  Programming-Languages-AllOther (193)
 


 

Back to Questions Page
 
Question
Print all the palindrome numbers.If a number is not
palindrome make it one by attaching the reverse to it.
eg:123
output:123321 (or) 12321
Rank Answer Posted By  
 Question Submitted By :: Nithya
I also faced this Question!!   © ALL Interview .com
Answer
#include<stdio.h>
main()
{
int n,m;
}
 
0
Santhu
 
 
Question
Reverse the part of the number which is present from
position i to j. Print the new number.
eg:
num=789876
i=2
j=5
778986
Rank Answer Posted By  
 Question Submitted By :: Nithya
I also faced this Question!!   © ALL Interview .com
Answer
#include <stdio.h>

void reverse ( int* ip_array, int st_pos, int ed_pos )
{
	if ( ( ip_array ) && ( st_pos < ed_pos ) ) {
		* ( ip_array + st_pos ) ^= * ( ip_array + 
ed_pos ) ^= * ( ip_array + st_pos ) ^= * ( ip_array + 
ed_pos );
		reverse ( ip_array, ++st_pos, --ed_pos );
	}
}

int main ( int argc, char* argv [] )
{
	int int_array [20];
	int number = 789876;
	int counter = 0;
	int nloop = 0;
	int start_pos = 2;
	int end_pos = 5;

	/* split the number into an array */
	while ( number ) {
		int_array [ counter++ ] = number % 10;
		number = number / 10;
	}

	/* reverse the splited array */
	reverse ( int_array, 0, counter - 1 );

	/* reverse for the particular position */
	if ( ( start_pos < end_pos ) && ( end_pos <= 
counter ) ) {
		reverse ( int_array, ( start_pos - 1 ), ( 
end_pos - 1 ) );
		
		number = 0;
		for ( nloop = 0; nloop < counter; nloop++ )
		{
			number *= 10;
			number += int_array [ nloop ];
		}

		printf ( "\n %d", number );
	}

	return ( 0 );
}
 
0
Abdur Rab
 
 
Question
We can draw a box in cprogram by using only one printf();& 
without using graphic.h header file?
Rank Answer Posted By  
 Question Submitted By :: Pradeep
This Interview Question Asked @   NIIT
I also faced this Question!!   © ALL Interview .com
Answer
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\n______________\n|______________|");
getch();
}

output:

 ______________
|______________|
 
0
Parmjeet Kumar
 
 
 
Question
Write a C Programm..
we press 'a' , it shows the albhabetical number is 1, if we 
press 'g' it shows the answer 7.. any can help me
Rank Answer Posted By  
 Question Submitted By :: J
I also faced this Question!!   © ALL Interview .com
Answer
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char ch;
int no;
printf("Enter the charactor:");
scanf("%c",&ch);
if(int(ch)>=65&&int(ch)<=91)
{
no=int(ch)-64;
printf("%d\n",no);
}
if(int(ch)>=97&&int(ch)<=123)
{
no=int(ch)-96;
printf("%d\n",no);
}
getch();
}
 
0
Gourav Agrawal
 
 
Answer
#include <stdio.h>

int main ( int argc, char* argv [] )
{
	char ch = '0';
	int nvalue = 0;
	while ( 1 ) {
		printf ("\n Enter the alphabet or press 0 
to exit :");
		scanf ( "%c", &ch );
		if ( ch == '0' ) break;
		nvalue = ( ( (int) 'a' <= (int) ch ) && ( 
(int) 'z' >= (int) ch ) ) 
			 ? ~( (int) 'a' - (int) ch ) + 2
			: ( ( (int) 'A' <= (int) ch ) && ( 
(int) 'Z' >= (int) ch ) )
			? ~( (int) 'A' - (int) ch ) + 2
			: 0;
		printf ("\n The Value :%d", nvalue );
	}

	return ( 0 );
}
 
0
Abdur Rab
 
 
 
Back to Questions Page
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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