Professional Documents
Culture Documents
Turbo C (Sample of Programming)
Turbo C (Sample of Programming)
A-102
Assignment: COMPRO
1. Write a program that prints the numbers 1 to 4 on the same line for two (2)
times. Write the program using the following methods:
a. Using one printf command (first line of output).
#include <stdio.h>;
main()
printf ("%d",1234);
getch();
#include <stdio.h>;
main()
printf ("%d",1);
printf ("%d",2);
printf ("%d",3);
printf ("%d",4);
getch();
}
2. Write a program that prints a box, an oval, an arrow and a diamond.
a. Box
#include <stdio.h>;
main()
getch();
b. OVAL
#include <stdio.h>;
main()
printf (" ... \n . .\n. .\n. .\n. .\n. .\n. .\n ... ");
getch();
c. Arrow
#include <stdio.h>;
main()
d. Diamond
#include <stdio.h>;
main()
getch();
a. C
#include <stdio.h>;
main()
getch();
b. A
#include <stdio.h>;
main()
{
getch();
c. M
#include <stdio.h>;
main()
getch();
4.
#include <stdio.h>;
main()
getch();
#include <stdio.h>;
main()
");