If 4 digits number is input through the keyboard, Write a
program to calculate sum of its 1st & 4th digit.

Answers were Sorted based on User's Feedback



If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st &..

Answer / anvesh

#include<stdio.h>
main()
{
int n,n1,n4;
printf("Enter 4 digit number:");
scanf("%d",&n);
n4=n%10;
n1=n/100;
printf("\nResult=",(n1+n4));
getch();
}

Is This Answer Correct ?    52 Yes 55 No

If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st &..

Answer / kadher masthan ,...sit

thiz z how 2 find the sum of first and last digit of any
number

#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
long int n,nf,nl,temp;
int count=-1;
printf("Enter a number:");
scanf("%ld",&n);
temp =n;
while(temp<0)
{
temp=temp/10;
c++;
}
nl=n%10;
nf=n/(pow(10,c));
printf("\n%ldResult=",(nf+nl));
getch();
}

Is This Answer Correct ?    9 Yes 23 No

Post New Answer

More C Interview Questions

What are inbuilt functions in c?

0 Answers  


i got 75% in all semester am i eligible for your company

0 Answers   Infosys,


write a program to find the largest and second largest integer from an array

2 Answers   Value Labs,


What is a class c rental property?

0 Answers  


When should a type cast not be used?

0 Answers  






Write a program that receives as input a number omaadel-n-print, four digits.

0 Answers  


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

0 Answers   TISL,


Explain how many levels deep can include files be nested?

0 Answers  


write a prgram of swapping with 2 valiables

6 Answers  


Describe dynamic data structure in c programming language?

0 Answers  


What is the g value paradox?

0 Answers  


find a number whether it is even or odd without using any control structures and relational operators?

22 Answers   Microsoft, Shashank Private Limited,


Categories