Write a program to initialize a four digit number of long integer type. Print the last and last two digit of
the number.
Answers
Answered by
1
Answer:
#include<stdio.h>
int main(void)
{
int sum,digit1,digit3,digit3,digit4;
printf("enter four digit integer:\n");
scanf("%d",&digit1,&digit2,&digit3,&digit4);
digit1=(digit1%1000)/10;
digit2=(digit2%1000)/10;
digit3=(digit3%1000)/10;
digit4=(digit4%1000)/10;
sum=digit1+digit2+digit3+digit4;
printf("answer is: %d\n", sum);
return 0;
}
Similar questions
English,
3 months ago
English,
3 months ago
Math,
3 months ago
Math,
7 months ago
Computer Science,
7 months ago
Social Sciences,
11 months ago
Computer Science,
11 months ago
Science,
11 months ago