If 4 digits number is input through the keyboard, Write a
program to calculate sum of its 1st & 4th digit.
Answer Posted / abhilash
/*Hey
guys check dis out, It will work for upto 4 digit number*/
void main()
{
int num,sum=0,rem;
printf("Enter a number");
scanf(" %d",&num);
rem=num%10;
sum=sum+rem;
while(n>10)
{
num=num/10;
}
rem=num%10;
sum=sum+rem;
printf("sum of 2 digits is: %d",sum);
getch();
}
Is This Answer Correct ? | 9 Yes | 8 No |
Post New Answer View All Answers
Why c is faster than c++?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
Explain how can I read and write comma-delimited text?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
List some applications of c programming language?
what are non standard function in c
What is difference between stdio h and conio h?
Explain how many levels deep can include files be nested?
Are comments included during the compilation stage and placed in the EXE file as well?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
praagnovation
What is c standard library?
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
What is 1f in c?