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 / bharghavi

#
#
void main()
{
int num,n1,n2,sum;
cout<<"enter a 4 digit no.";
cin>>num;
n1=num/1000;
n2=num%10;
sum=n1+n2;
cout<<"sum of 1st & 4th digit is"<<sum;
}

Is This Answer Correct ?    129 Yes 35 No

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

Answer / sourav sinha

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int num,n1,n2,sum;
clrscr();
printf("Enter 4 digit number:");
scanf("%d",&num);
n1=num/1000;
n2=num%10;
sum=n1+n2;
printf("Sum of 1st & 4th digit number is=%d",sum);
getch();
}
enjoy!!!!!!!!!!!!

any program just mail me:
ssmartinp@gmail.com

Is This Answer Correct ?    57 Yes 15 No

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

Answer / chirag

#include<stdio.h>
#include<conio.h>
void main()
{
int num,a,b,sum;
clrscr();
printf("enter a four digit no");
scanf("%d",&num);
a=num%10;
b=num/1000;
sum=a+b;
printf("sum is =%d",sum);
getch();
}

Is This Answer Correct ?    30 Yes 15 No

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

Answer / nikita singh

#include<stdio.h>
#include<conio.h>
void main()
{
int num,a,b,sum;
clrscr();
printf("enter a four digit no");
scanf("%d",&num);
a=num%10;
b=num/1000;
sum=a+b;
printf("sum is =%d",sum);
getch();
}

Is This Answer Correct ?    24 Yes 15 No

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

Answer / vinay

#include<stdio.h>
main()
{
int n,n1,n4,z;
printf("Enter 4 digit number:");
scanf("%d",&n);
n4=n%10;
n1=n/1000;
z=n1+n4;
printf("Result=%d",z);
system("pause");
}

Is This Answer Correct ?    11 Yes 6 No

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

Answer / anil

#include<stdio.h>
#include<conio.h>
void main()
{
int num,first,last,total;
printf("enter the 4 digit number");
scanf("%d",&num);
first=num/1000;
last=num%10;
total=first+last;
printf("the total of first and last digit is %d",total);
getch();
}

Is This Answer Correct ?    7 Yes 4 No

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

Answer / 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

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

Answer / jagannatha reddy

#include<stdio.h>
#include<conio.h>
void main()
{
int i,r,n,m=0;
clrscr();
printf("enter any 4 digit number");
scanf("%d",&n);
r=n%10;
for(i=1;i<=3;i++)
{
n=n/10;
}
printf("the sum is %d",(r+m));
}

Is This Answer Correct ?    5 Yes 5 No

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

Answer / amrit bhujel

#include<stdio.h>
int main(void)
{
int num,a,b;
printf("enter 4 digit number");
scanf("%d",&num);
a=num/1000;
b=num%10;
printf("the num is %d %d",a,b);
return 0;
}

Is This Answer Correct ?    3 Yes 3 No

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

Answer / akhiltelaprolu

#include<stdio.h>
main()
{
int n,a[20],b[20],i,j;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
i=0;
for(j=0;j<n/2;j++)
{
b[j]=a[i]+a[n-1];
i++;
n=n-1;
}
for(j=0;j<n/2;j++)
printf("%d",b[j]);
if(n%2!=0)
printf("%d",a[n/2]):
}

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

write a program to find the frequency of a number

4 Answers   Infosys,


#include<stdio.h> { printf("Hello"); } how compile time affects when we add additional header file <conio.h>.

0 Answers  


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

0 Answers   IBM,


Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will this compile?

4 Answers   Oracle,


When should a type cast not be used?

0 Answers  






GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

0 Answers  


In c language can we compile a program without main() function?

0 Answers  


To what value do nonglobal variables default? 1) auto 2) register 3) static

4 Answers  


Write a program to generate prime factors of a given integer?

9 Answers   Microsoft,


WHAT IS HEADER?

8 Answers   ProKarma, TCS,


who is the editor of 'pokemon'?

1 Answers  


write a program for the normal snake games find in most of the mobiles.

0 Answers   Accenture, Wipro,


Categories