Create an HLA Assembly language program that prompts for two value from the user and then prints the desired number pattern shown starting with the larger of the two values and repeating them the number of times that matches the smaller of the two values. Here are some example program outputs: Feed me: 3 Feed me: 4 444_333 Feed me: 6 Feed me: 2 66_22 Feed me: 1 Feed me: 3 3_1 The following C statements match the program specifications stated above. Use them as the basis for building your Assembly program: // print the desired pattern int x = 0, y = 0; int i, first, second; scanf( "Feed Me: %d", &x ); scanf( "Feed Me: %d", &y ); // the larger value will be first // the smaller value will be second if (x > y) { first = x; second = y; } else { first = y; second = x; } for( i = 1; i <= second; i++ ) { printf( "%d", first ); } printf( "_" ); for ( i = 1; i <= second; i++ ) { printf( "%d", second ); } printf ( "\n" );
Create an HLA Assembly language program that prompts for two value from the user and then prints the desired number pattern shown starting with the larger of the two values and repeating them the number of times that matches the smaller of the two values.
Here are some example program outputs:
Feed me: 3
Feed me: 4
444_333
Feed me: 6
Feed me: 2
66_22
Feed me: 1
Feed me: 3
3_1
The following C statements match the program specifications stated above. Use them as the basis for building your Assembly program:
// print the desired pattern
int x = 0, y = 0;
int i, first, second;
scanf( "Feed Me: %d", &x );
scanf( "Feed Me: %d", &y );
// the larger value will be first
// the smaller value will be second
if (x > y)
{
first = x;
second = y;
}
else
{
first = y;
second = x;
}
for( i = 1; i <= second; i++ )
{
printf( "%d", first );
}
printf( "_" );
for ( i = 1; i <= second; i++ )
{
printf( "%d", second );
}
printf ( "\n" );
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images