Computer Science, asked by sarthakpandey2986, 11 months ago

write a program to input no and print last two digits of number in c​

Answers

Answered by TheDreamCatcher
14

Answer:

The program output is also shown below.

* C Program to Extract Last two Digits of a given Year.

int year, yr;

printf("Enter the year ");

scanf("%d", &year);

yr = year % 100;

printf("Last two digits of year is: %02d", yr);

return 0;

The trick to finding the second last digit of any number ending with 1 is the UNIT DIGIT of the product of the unit digit of the power and the ten's digit of the base. It is clear that the unit digit of the given number is 1 and we have to identify the ten's place digit of the same.

Answered by msgrangeron
0

Answer:

#include<stdio.h>

int main()

{

  int n,ltd;

  scanf("%d",&n);

  ltd=n%100;

  printf("%d",ltd);

}

Explanation:

n-to get the value

ltd-last two digit

condition to print the last two digit -n%100

Similar questions