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

please tell me the logic for this C program : INPUT (string):ABCD OUTPUT :BCDA CDAB DABC

2 Answers   Mphasis,


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

0 Answers   Case, IBM,


Can a void pointer point to a function?

0 Answers  


write a program structure to find average of given number

1 Answers  


how can i get output the following... 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 and 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 plz plz...

3 Answers  






find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

0 Answers   Microsoft,


List the different types of c tokens?

0 Answers  


what are the various memory handling mechanisms in C ?

4 Answers   HP,


what is c?

4 Answers   IBM, TCS,


What is the value of h?

0 Answers  


What is a stream?

0 Answers  


If the size of int data type is two bytes, what is the range of signed int data type?

0 Answers  


Categories