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
There is a lucky draw held every day.
if there is a winning number eg 1876,then all possible 
numbers like 1867,1687,1768 etc are the numbers that match 
irrespective of the position of the digit.
Thus all these numbers qualify fr the lucky draw prize
Assume there is no zero digit in any numbers.
write a program to show all the possible winning numbers if 
a "winning number"is passed as an arguments to the function.
 Question Submitted By :: C-Code
I also faced this Question!!     Answer Posted By  
 
Answer
# 1


void main()
{
int sum=0,mul=1,s=0,m=1,i,t,nn,j=1;
clrscr();

printf("Enter number without '0' as its digit
\n");
scanf("%d",&nn);

while(nn>0)
{
sum=sum+(nn%10);
mul=mul*(nn%10);
nn=nn/10;
j=j*10;
}

printf("j %d sum %d mul %d",j,sum,mul);


for(i=j/10;i<j;i++)
{ t=i;
while(t>0)
{
s=s+(t%10);
m=m*(t%10);
t=t/10;
}
if(s==sum && mul==m)
printf("\n%d",i);
s=0;
m=1;
}

getch();

}
 
Is This Answer Correct ?    7 Yes 2 No
Guest
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?   2
{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }   3
main() { int i=5; printf(“%d”,i=++i ==6); }   1
union u { struct st { int i : 4; int j : 4; int k : 4; int l; }st; int i; }u; main() { u.i = 100; printf("%d, %d, %d",u.i, u.st.i, u.st.l); } a. 4, 4, 0 b. 0, 0, 0 c. 100, 4, 0 d. 40, 4, 0 HCL 1
main() { int i=5,j=6,z; printf("%d",i+++j); }   2
Is this code legal? int *ptr; ptr = (int *) 0x400;   1
main() { char *p = "hello world"; p[0] = 'H'; printf("%s", p); } a. Runtime error. b. “Hello world” c. Compile error d. “hello world” HCL 5
Write a C function to search a number in the given list of numbers. donot use printf and scanf Honeywell 4
void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }   1
#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }   1
Is the following code legal? typedef struct a { int x; aType *b; }aType   1
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); } CSC 4
 
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