Introduction
Write C program to swap first and last digit of a number
Write C program to swap first and last digit of a number
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void) {
int num, last, first, temp, swap, count = 0;
printf("Enter any number: ");
scanf("%d", &num);
temp = num;
last = temp % 10;
count = (int)log10(temp);
while(temp>=10)
{
temp /= 10;
}
first = temp;
swap = (last * pow(10, count) + first) + (num - (first * pow(10, count) + last));
printf("Last Digit: %d\n", last);
printf("First Digit: %d\n", first);
printf("%d is swapped to %d\n", num, swap);
return 0;
}
Write C program to print multiplication table of a given number
Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …
C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …