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
 
main() { char *p; p="%d\n"; p++; p++; printf(p-2,300); }   1
¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-30 but in same question if we write as- ¦void main() ¦{ ¦int i=10; ¦ int j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-33 why output is changed from 30 to 33. Can any body answer...   1
Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.   1
void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }   1
main() { int i=10; i=!i>14; Printf ("i=%d",i); }   1
int i; main(){ int t; for ( t=4;scanf("%d",&i)-t;printf("%d\n",i)) printf("%d--",t--); } // If the inputs are 0,1,2,3 find the o/p   2
How do you sort a Linked List (singly connected) in O(n) please mail to pawan.10k@gmail.com if u can find an anser...i m desperate to knw... Oracle 6
Finding a number multiplication of 8 with out using arithmetic operator NetApp 8
Printf can be implemented by using __________ list.   3
write a origram swaoing valu without 3rd variable   2
How to read a directory in a C program?   4
main ( ) { static char *s[ ] = {“black”, “white”, “yellow”, “violet”}; char **ptr[ ] = {s+3, s+2, s+1, s}, ***p; p = ptr; **++p; printf(“%s”,*--*++p + 3); }   1
 
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