Computer Science, asked by bkpaf095, 7 months ago

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 nehasahani23
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