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
pierrot's divisor program using c or c++ code
How can a program be made to print the line number where an error occurs?
What is calloc malloc realloc in c?
Write a factorial program using C.
What is main () in c language?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
Explain the difference between call by value and call by reference in c language?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
What are examples of structures?
Describe static function with its usage?
a program that can input number of records and can view it again the record
What is the use of bit field?
How can I recover the file name given an open stream or file descriptor?
How can I change their mode to binary?