write a program in Swift Xcode that reads an integer and displays, using asteris
ID: 3907726 • Letter: W
Question
write a program in Swift Xcode that reads an integer and displays, using asterisks a filled and hollow square, placed next to each other. for example if side length is 5 the program should display like so.This program prints a filled and hollow square.
Enter the length of a side: 5
***** *****
***** * *
***** * *
***** * *
***** *****
write a program in Swift Xcode that reads an integer and displays, using asterisks a filled and hollow square, placed next to each other. for example if side length is 5 the program should display like so.
This program prints a filled and hollow square.
Enter the length of a side: 5
***** *****
***** * *
***** * *
***** * *
***** *****
write a program in Swift Xcode that reads an integer and displays, using asterisks a filled and hollow square, placed next to each other. for example if side length is 5 the program should display like so.
This program prints a filled and hollow square.
Enter the length of a side: 5
***** *****
***** * *
***** * *
***** * *
***** *****
Explanation / Answer
func printAstrix(){
// Readan integer
// For loop to print rows
// For loop to print Astix
//To print a value without a line break after it, pass an empty string as the terminator
}
if i == 1 || i == inputNumber {
// print hollow
print(" ", terminator: "")
// For loop to print Astix with filled and a hollow square
//To print a value without a line break after it, pass an empty string as the terminator
}
}
else {
// For loop to print Astix with filled and a hollow square
//To print a value without a line break after it, pass an empty string as the terminator
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.