Write a program to input 3 integer digits (from 100 - 999), then in the numbers letters in hundreds, tens, and units ?

I need help

2 Comments

Can you convert this c++ code to matlab for me?
void main ()
{
int x;
do
{
printf ( "\ nx =" );
scanf ( "% d" , & x);
}
while (x <100 || x> 999);
printf ( "\ n hundreds :% d" , x, x / 100);
printf ( "\ n tens :% d" , x, (x% 100) / 10);
printf ( "\ n units :% d" , x, (x% 100)% 10);
getch ();

Sign in to comment.

Answers (1)

1 Comment

I can't convert when reading this document, can you give more instructions ?
void main()
{
int x;
do
{
printf("\n x = ");
scanf("%d", &x);
}
while(x < 100 || x > 999 );
printf("\n hundreds : %d", x, x/100);
printf("\n tens: %d", x, (x%100)/10);
printf("\n units: %d", x, (x%100)%10);
getch();
}

Sign in to comment.

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products

Release

R2016b

Asked:

on 21 Sep 2022

Edited:

on 21 Sep 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!