ALLInterview.com :: Home Page            
 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                      
Google
   
 
Categories >> Code Snippets >> Programming Code >> C Code
 
 


 

 
 C Code interview questions  C Code Interview Questions (401)
 C++ Code interview questions  C++ Code Interview Questions (121)
 VC++ Code interview questions  VC++ Code Interview Questions (2)
 Java Code interview questions  Java Code Interview Questions (57)
 Dot Net Code interview questions  Dot Net Code Interview Questions (113)
 Visual Basic Code interview questions  Visual Basic Code Interview Questions (8)
 Programming Code AllOther interview questions  Programming Code AllOther Interview Questions (37)
Question
given integer number,write a program that displays the 
number as follows:
First line :all digits
second line : all except the first digit
.
.
.
.
Last line : the last digit
 Question Submitted By :: C-Code
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
#include<stdio.h>
main()
{
int num,dcount,temp,i,j;
int array[20];
printf("\nEnter a number:");
scanf("%d",&num);
temp=num;
for(dcount=0;num!=0;num=num/10,dcount++);
for(i=dcount;i>0;i--)
{
array[i-1]=temp%10;
temp=temp/10;
}
printf("Required Pattern is:\n");
for(i=0;i<dcount;i++)
{
for(j=i;j<dcount;j++)
printf("%d\t",array[j]);
printf("\n");
}

}
 
Is This Answer Correct ?    11 Yes 2 No
Jickson
 
Answer
# 2
#include <stdio.h>
int main()
{
int i,j,index,n,a[10];
printf("enter a number");
scanf("%d",&n);
for(i=0;n!=0;i++)
{
a[i]=n%10;
n=n/10;
}
i=i-1;
printf("output\n");
for(;i>=0;i--)
{
for(j=i;j>=0;j--)
printf("%d\t",a[j]);
printf("\n");
}
return 0;
}
 
Is This Answer Correct ?    7 Yes 2 No
Shams
 
 
 
Answer
# 3
#include <iostream>
#include<stdio.h>
#include<cstdlib>
#include<unistd.h>
#include<time.h>
#include<string.h>
using namespace std;
int main()
{
int i,b,j,index,n,a[10];
printf("enter a number");
scanf("%d",&n);
b=n;
for(i=0;n!=0;i++)
{
a[i]=n%10;
n=n/10;
}
b=i;
i=i-1;
printf("output\n");
for(;i>=0;i--)
{
for(j=i;j>=0;j--)
printf("%d\t",a[j]);
printf("\n");
for(int k=0;k<b-i;k++)
printf("\t");
}
return 0;
}
 
Is This Answer Correct ?    3 Yes 0 No
Shams
 
Answer
# 4
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,n;
printf("enter any number : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=i;j<=n;j++)
{
printf("%d ",j);
}
printf("\n");
}
getch();
}
 
Is This Answer Correct ?    6 Yes 9 No
Mohit
 
Answer
# 5
#include <stdio.h>

int main(int argc, char* argv[])
{
int num = 15;
int i = 1;
int j = 1;

for( ; i <= num; i++)
{
for( j = i; j <= num; j++)
{
printf("%-3d ",j);
}
printf("\n\n");
}

return 0;
}
 
Is This Answer Correct ?    2 Yes 7 No
Pavan_mustyala
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
How we print the table of 3 using for loop in c programing?   7
Derive expression for converting RGB color parameters to HSV values   1
Write a routine that prints out a 2-D array in spiral order Microsoft 3
Is it possible to type a name in command line without ant quotes? Infosys 1
void main() { int const * p=5; printf("%d",++(*p)); } Infosys 3
main() { int i=400,j=300; printf("%d..%d"); }   3
void main() { int i=5; printf("%d",i+++++i); }   2
main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }   1
Write a program to print a square of size 5 by using the character S. Microsoft 5
main() { int i =10, j = 20; clrscr(); printf("%d, %d, ", j-- , --i); printf("%d, %d ", j++ , ++i); } a. 20, 10, 20, 10 b. 20, 9, 20, 10 c. 20, 9, 19, 10 d. 19, 9, 20, 10 HCL 4
plz tell me the solution.......... in c language program guess any one number from 1 to 50 and tell that number within 8 asking question in yes or no............... Wipro 2
main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }   2
 
For more C Code Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com