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
All technical questions
What are bitwise shift operators in c programming?
What is memcpy() function?
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
Explain bitwise shift operators?
Why is c fast?
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
What are linked lists in c?
Explain 'bit masking'?
Is c is a low level language?
What are conditional operators in C?
Is c procedural or object oriented?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
What is the function of multilevel pointer in c?