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 is the difference between variable declaration and variable definition in c?

0 Answers  


Can an array be an Ivalue?

0 Answers   EXL,


Explain what is the difference between declaring a variable and defining a variable?

1 Answers  


how could explain about job profile

0 Answers  


How to receive strings with spaces in scanf()

7 Answers  






Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

0 Answers   HCL,


How to print India by nested loop? I IN IND INDI INDIA

4 Answers   NIIT, Wipro,


Do you know the purpose of 'register' keyword?

0 Answers  


Can a pointer be static?

0 Answers  


which one is better structure or union?(other than the space occupied )

2 Answers  


in C-programming language without using printf statement can we get output r not ? if yes how and if no also how ?

11 Answers   IBM,


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

0 Answers  


Categories