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.
Answer / guest
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 ? | 11 Yes | 2 No |
String copy logic in one line.
Write a c program to search an element in an array using recursion
How will u find whether a linked list has a loop or not?
programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h
how to concatenate the two strings
main() { char a[4]="HELLO"; printf("%s",a); }
Write a routine that prints out a 2-D array in spiral order
void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }
Write a program to receive an integer and find its octal equivalent?
main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", x--); } } a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above
Print an integer using only putchar. Try doing it without using extra storage.
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }