1.4 Write a program that will print the following figure using suitable characters
---- ----
>>-------->
---- ----
Solution:
Yet another trick where you have to know to align characters. That's all. I'll be honest and tell you that, I achieved it using trial and error. I mean, no matter how well you count, the alignment screws up on it's own. :) Nothing better than running the program.
Program:
/*Program 1.1.4 */
#include stdio.h
/*This is a header file.*/
#include conio.h
/*This is another header file that we require for using getch()*/
int main()
{
printf("\n ---- ---- ");
printf("\n >>--------> ");
printf("\n ---- ---- ");
getch();
return 0;
}
Output:
---- ----
>>-------->
---- ----
Description:
Quite Simple again. Not much to explain. Do read up on 001 through 003 to get to know the previous programs.