Tech Study

Write C program to find first and last digit of any number

Introduction

Write C program to find first and last digit of any number

#include <stdio.h>
 
main()
{
    int num, last ;
    printf("Enter any number : ");
    scanf("%d", &num);
 
    last = num%10;
    printf("The last digit of entered number: %d\n", last);
 
    while(num>=10)
    {
        num = num/10;
    }
 
    printf("The first digit of entered number: %d\n", num);
}

Result

Write C program to find first and last digit of any number
Write C program to find first and last digit of any number

TaggedWrite C program to find first and last digit of any number

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more