c program to arrange digits in a no in ascending and
descending order
Answer / chand
#include <stdio.h>
int main() {
int num,i=0,size=0,j,temp;
scanf("%d",&num);
int k=num;
while(num>0)
{
int rem;
rem=num%10;
size++;
num/=10;
}
int arr[size];
while(k>0)
{
int rem1;
rem1=k%10;
arr[i]=rem1;
i++;
k/=10;
}
for(i=0;i<size;i++)
{
for(j=i+1;j<size;j++)
{
if(arr[i]>arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
for(i=0;i<size;i++)
{
printf("%d ",arr[i]);
}
return 0;
}
Is This Answer Correct ? | 22 Yes | 7 No |
write a program that will accept two integers and will implement division without using the division operator if the second value is an odd number and will implement multiplication without using multiplication operator if the second value is an even number.
Given an array of characters, how would you reverse it? How would you reverse it without using indexing in the array?
Where is volatile variable stored?
Write a simple program to find the size of different basic data types in C.
Can we access array using pointer in c language?
What is the role of && operator in a program code?
Here is a good puzzle: how do you write a program which produces its own source code as output?
#include<stdio.h> main() { char s1[]="Ramco"; char s2[]="Systems"; s1=s2; printf("%s",s1); } Find the output
Why c is known as a mother language?
i want to know aptitude questions,technical questions
What does 2n 4c mean?
How can you invoke another program from within a C program?