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 |
void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }
In the following pgm add a stmt in the function fun such that the address of 'a' gets stored in 'j'. main(){ int * j; void fun(int **); fun(&j); } void fun(int **k) { int a =0; /* add a stmt here*/ }
#define a 10 int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } void foo() { #undef a #define a 50 }
What is the output for the program given below typedef enum errorType{warning, error, exception,}error; main() { error g1; g1=1; printf("%d",g1); }
How to return multiple values from a function?
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
0 Answers Mbarara University of Science and Technology,
write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details
void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }
Finding a number multiplication of 8 with out using arithmetic operator
what is oop?
Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.
Question: We would like to design and implement a programming solution to the reader-writer problem using semaphores in C language under UNIX. We assume that we have three readers and two writers processes that would run concurrently. A writer is to update (write) into one memory location (let’s say a variable of type integer named temp initialized to 0). In the other hand, a reader is to read the content of temp and display its content on the screen in a formatted output. One writer can access the shared data exclusively without the presence of other writer or any reader, whereas, a reader may access the shared memory for reading with the presence of other readers (but not writers).