Computer Science, asked by abarna2649, 10 months ago

Baras entered through keyboard for example 234 output should be 2 3 4 write a C program to accomplish the same​

Answers

Answered by StaceeLichtenstein
0

Program of  C is shown in the explanation part.

Output:

Enter the num:234

2 3 4

Explanation:

#include <stdio.h> // header file

int main() // main method

{

   int n,rev=0; // variable declaration

   printf(" Enter the num:");

   scanf("%d",&n); // input number

   while(n!=0) // iterating over the loop

   {   int t=n%10; // calculating reminder

       rev=(rev*10)+t; // reverse the number

       n=n/10;

   }

while(rev!=0)    // iterating over the loop

{

int t=rev%10;// calculating reminder

printf("%d ",t); // print the original number with space

rev=rev/10;

}

return 0;

}

  • Read a number by user in the "n" variable of "int" type.
  • iterating over the while .In this loop we reverse the number n in the "rev' variable.  
  • Again iterating over the loop to print the number in the  formatted order which is mention in the question.

Learn more : C program to print the number 234 in 2 3 4 format

  • Write a c program to reverse a given number.

      https://brainly.in/question/6789921

  • Write a program in c to accept a number and display the digits in words

      https://brainly.in/question/7303393

Similar questions