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
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
What is c language & why it is used?
#include<stdio.h> int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
What is the difference b/w Structure & Array?
What is the difference between malloc() and calloc()?
1.write a program to merge the arrays 2.write efficient code for extracting unique elements from a sorted list of array?
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
What is the difference between File pointer and Internal Charecter Pointer?
What standard functions are available to manipulate strings?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
what is the difference between declaration and definition of a variable or function ?