JSON Variables

Program which takes input of a 4 digit no. and prints the output in reverse | Tech Arena






So this is the 2nd question of the series " Programming in C with Tech Arena". Many users on the internet search for this question and plenty of users also have asked this question from me that Write the program which takes the input of a 4 digit number and prints the output as the reverse of the numbers input by the user.


Make sure that you follow the series of "Programming in C with Tech Arena" to never ever miss any of our latest updates. let's go to the solution straight away -

Program which takes input of a 4 digit no. and prints the output in reverse



Write the program which takes the input of a 4 digit number and prints the output as the reverse of the numbers.


Well if you are new to the language C then I highly recommend that you should consider Geeks for Geek " Introduction to C" because you can learn the basics from there and then you will be able you understand that what is written in the source code without any confusion, Click here for Introduction to C.


So in this question, you have been asked to reverse the number that has been entered by the user which is not a very difficult task to do. Take a look at Source Code:-


SOURCE CODE-


#include <stdio.h>

int main() // you can also use void main() no issues

{

    int n, rem;

    printf("\n enter the four digit number");

    scanf("%d",& n);

    rem= n%10;

    printf ("%d",rem);

    n= n/10;

    rem= n%10;

    printf("%d", rem);

    n= n/10;

    rem= n%10;

    printf("%d", rem);

    rem= n/10;

    printf("%d", rem);
   

}


OUTPUT


Program which takes input of a 4 digit no. and prints the output in reverse






Post a Comment

0 Comments

]