answersLogoWhite

0


Best Answer

Everyone i am ajay Verma and i answer this question, Write this programe in note pad:-

using System;

class MyClass

{

public static void Main(string [] args)

{

int n,d,result=1,sum=0;

Console.WriteLine("Enter any Number");

n=Convert.ToInt32(Console.ReadLine());

for(;n>0;)

{

d=n%10;

Console.WriteLine(d);

n=n/10;

}

}

}

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

#include

#include

#include

//My name is Prince Fred in Uganda, East Africa

// please if you like this, e-mail me atmuteesafred@yahoo.com or,

// call +256-712-134-996 to make me your friend.

// I used borland c++ 4.5 to compile.

void pw(int,char[]);

char *one[]={" "," one"," two"," three"," four"," five"," six"," seven",

"eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};

char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","seventy"," eighty"," ninety"};

void main()

{

int n;

clrscr();

printf("Enter any 3 digit no: ");

scanf("%d",&n);

if(n<=0)

printf("Enter numbers greater than 0");

else

{

pw((n/100)," hundred and");

pw((n%100)," ");

}

getch();

}

void pw(int n,char ch[])

{

(n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);

if(n)

printf("%s ",ch);

}

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

#include<iostream.h>

#include<conio.h>

void main(){

clrscr();

const int s = 3;

int a[s];

int x,y,z;

for (int i=0; i<s; i++)

cin >> a[i];

x = a[0];

y = a[1];

z = a[2];

i = 0;

cout<<x<<y<<z;

cout<<"n";

while(1){

a[s] = a[i];

if (i != s - 1){

a[i] = a[i+1];

a[i+1] = a[s];

}

else {

a[i] = a[0];

a[0] = a[s];

i=-1;

}

i++;

if (a[0] z)

break;

for (int j = 0; j < s; j++)

cout<<a[j];

cout<<"n";

}

getch();

}

This answer is:
User Avatar

User Avatar

Wiki User

6y ago

When dealing with a combination (in the mathematical sense), the order of the elements does not matter. Thus {1, 2, 3} is the exact same combination as {3, 2, 1}. The latter is known as a permutation (of the combination). For any given 3-digit combination there are 6 permutations, however if any two of the three digits are the same digit, then there are only 3 permutations, and if all three digits are the same then there can be only one permutation.

The following function will print all possible permutations of any 3 digits.

void print_permutations (int a, int b, int c) {

// sort digits in ascending order

if (b<a) a^=b^=a^=b; if (c<b) c^=b^=c^=b; if (b<a) a^=b^=a^=b;

if (a==b && b==c) { // all 3 digits match

printf ("{%d, %d, %d}\n", a, b, c);

} else if (a==b) { // first two digits match

printf ("{%d, %d, %d}\n", a, b, c);

printf ("{%d, %d, %d}\n", a, c, b);

printf ("{%d, %d, %d}\n", c, a, b);

} else if (b==c) { // last two digits match

printf ("{%d, %d, %d}\n", a, b, c);

printf ("{%d, %d, %d}\n", b, a, c);

printf ("{%d, %d, %d}\n", b, c, a);

} else { // all digits unique

printf ("{%d, %d, %d}\n", a, b, c);

printf ("{%d, %d, %d}\n", a, c, b);

printf ("{%d, %d, %d}\n", b, a, c);

printf ("{%d, %d, %d}\n", b, c, a);

printf ("{%d, %d, %d}\n", c, a, b);

printf ("{%d, %d, %d}\n", c, b, a);

}

}

To test the function, use the following:

int main () {

int a, b, c;

printf ("Enter three digits: ");

scanf ("%d %d %d", &a, &b, &c);

print_permutations (a, b, c);

return 0;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a c program to accept 3 digits and print all possible combinations from these digits?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Using while loop write a program which calculates the product of digits from 1 to 5 and also show these nos vertically?

Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.


How do you write a Java program to accept a 3-digits integer number and print out the highest digit from the derived input?

The tricky part is getting the individual digits. There are basically two ways to do this: 1) Convert the number to a string, and use string manipulation to get the individual digits. 2) Repeatedly divide the number by 10. The digit is the remainder (use the "%" operator). To actually get the highest digit, initially assume that the highest digit is zero (store this to a variable, called "maxDigit" or something similar). If you find a higher digit, replace maxDigit by that.


Write a program in java to enter 3 digits or more arrange the digits of the entered number in ascending order and display the result?

public static void main(String[] args) { int val = 100; int val1 = 50; System.out.println("Number of digits in " + val + " is: " + new String(val + "").length()); System.out.println("Number of digits in " + val1 + " is: " + new String(val1 + "").length()); }


What is radix in number system?

The radix refers to the base of a number system: the total number of possible digits. The decimal number system that we all use is base ten, as it has ten distinct digits (0,1,2,3,4,5,6,7,8,9). Commonly used bases in computing include binary, octal, and hexadecimal, which have two, eight, and sixteen digits, respectively.


How to write A Java program to print number of digits in a given number?

One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.

Related questions

What is the number of possible combinations using 7 digits?

128


How many possible 4 number combinations can you get using numbers 0-9?

0000-9999 (10x10x10x10 or 104) = 10,000 possible combinations allowing for repeated digits. If you are not able to repeat digits then it's 10 x 9 x 8 x 7 or 5,040 possible combinations without repeated digits.


How many combinations of 5 are possible from 30 digits?

There are: 30C5 = 142,506


I have a Lock with 3 wheels and the digits 0 to 9 on it. what is the most combinations possible?

10 possible numbers on each wheel equals 10x10x10 or 1000 combinations possible.


Using 4 digits what is the total number of combinations for a 4 digit lock code?

If the digits can repeat, then there are 256 possible combinations. If they can't repeat, then there are 24 possibilities.


How many different number combinations are in the world?

Since a number can have infinitely many digits, there are infinitely many possible combinations.


What is the number of possible 9 digit social security numbers if the digits can't be repeated?

9x8x7x6x5x4x3x2x1 or 9! which equals 362880 possible combinations if no digits are repeated


What combinations can you make with numbers 1472580?

You can make: 1 combination containing 0 digits, 7 combinations containing 1 digits, 21 combinations containing 2 digits, 35 combinations containing 3 digits, 35 combinations containing 4 digits, 21 combinations containing 5 digits, 7 combinations containing 6 digits, and 1 combinations containing 7 digits. That makes 2^7 = 128 in all.


How combination in a 9 digit number?

There are different numbers of combinations for groups of different sizes out of 9: 1 combination of 9 digits 9 combinations of 1 digit and of 8 digits 36 combinations of 2 digits and of 7 digits 84 combinations of 3 digits and of 6 digits 126 combinations of 4 digits and of 5 digits 255 combinations in all.


What combinations can you make with numbers 1 4 7 2 5 8 0?

Assuming the digits cannot be repeated, there are 7 combinations with 1 digit, 21 combinations with 2 digits, 35 combinations with 3 digits, 35 combinations with 4 digits, 21 combinations with 5 digits, 7 combinations with 6 digits and 1 combinations with 7 digits. That makes a total of 2^7 - 1 = 127: too many for me to list. If digits can be repeated, there are infinitely many combinations.


What are the possible different combinations of numbers in four digits?

If the numbers contain zeros, the total number of combinations is 10,000. You can work this out easily logically: For ten single-digit numbers (0,1,2,3,4,5,6,7,8,9) then there are 10 possible 'combinations' For numbers with 2 digits then for each possible digit in the 10s column (e.g. in the 20s range) there are another 10 possible combinations (20,21,22,23,24,25,26,27, 28,29). As there are 10 possible ranges (single digits, teens, twenties, thirties etc) there will be 10 X 10 or 100 possible combinations. using the same logic, for three digits, there will be 10 X 10 X 10 or 1000 digits. And for 4 digits there will be 10 x 10 x 10 x 10 = 10,000 possible combinations. So for a number, say, with x digits, the total number of combinations of those digits will be 10 x 10 x 10..... etc with x numbers of 10s in the calculation. You can find out the number of combinations of any set of letters or numbers in the same way. as an example, to find out, say, the possible combinations of letters in the alphabet of 26 letters, then using the same method this can be given as 26 x 26 x 26 x 26............. with 26 '26's' in a row multiplied together. This gives the staggering amount of approximately 615612 followed by 31 zeros.


Can you list all possible combinations there are from 0-9?

Perhapsf you specified the number of digits. e.g. 0-9 with two digits.