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
Is c still relevant?
Why we not create function inside function.
What is the difference between far and near in c?
Is r written in c?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }
What does main () mean in c?
What are the key features in c programming language?
what does static variable mean?
What are static variables in c?
What is the size of array float a(10)?
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
C program to find all possible outcomes of a dice?
What are the restrictions of a modulus operator?
Why is main function so important?
What are the features of c languages?