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
what are enumerations in C
Was 2000 a leap year?
Is null equal to 0 in sql?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
How to get string length of given string in c?
Is a pointer a kind of array?
What is a program flowchart and how does it help in writing a program?
What does void main () mean?
Define macros.
Explain how do you search data in a data file using random access method?
int i=10; printf("%d %d %d", i, i=20, i);
what are the facialities provided by you after the selection of the student.
What are the applications of c language?
Differentiate between null and void pointers.
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above