simple c program for 12345 convert 54321 with out using string
Answer Posted / ruchi
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,r,s=0,i=0,m,r1,m1,m2,p,d,s1;
clrscr();
printf("enter the number ");
scanf("%d",&n);
m=n;
while(n>0)
{
r=n%10;
n=n/10;
i=i+1;
}
m1=m%10;
d=m/10;
p=m1*pow(10,i=i-1);
while(d>=10)
{
m2=d%10;
d=d/10;
s=(s+m2*pow(10,i=i-1));
}
s1=(s+p+d*pow(10,i=i-1));
printf("%d",s1);
getch();
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
What is keyword with example?
What does typedef struct mean?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
how to construct a simulator keeping the logical boolean gates in c
while initialization of array why we use a[][2] why not a[2][]...?
What are the types of pointers?
What is pass by reference in c?
Explain how to reverse singly link list.
A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?
Explain how can you restore a redirected standard stream?
Tell us something about keyword 'auto'.
How to write c functions that modify head pointer of a linked list?
Explain what is the benefit of using const for declaring constants?
Write a program to print factorial of given number using recursion?