labprog4_2010

labprog4_2010 - 1 2 3 4 9 10 1 2 3 4 9 10 1 2 3 4 9 10 iii)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Swinburne University of Technology Faculty of Engineering and Industrial Sciences HES1300 Robotics & Mechatronics Project 1 Laboratory assignment 4: To practice the use of control structure commands in C, students are asked to write a simple C program (using selection and repetition commands) to print numbers from 1 to 10 in various shapes such as: i) 1 2 3 4 … 9 10 ii) 1 2 3 4 … 9 10 1 2 3 4 … 9 10 1 2 3 4 … 9 10 1 2 3 4 … 9 10 1 2 3 4 … 9 10 1 2 3 4 … 9 10
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 2 3 4 9 10 1 2 3 4 9 10 1 2 3 4 9 10 iii) 1 1 2 1 2 3 1 2 3 4 iv) 1 1 2 1 2 3 1 2 3 4 . v) *****1***** ****1*2**** ***1*2*3*** Homework: In the next step, modify your code to print the above forms upside down. Finally, write code that prints those numbers in a diamond and a two triangle as shown below. Solution for section (i): #include<stdio.h> int main() { int j; for( j = 1; j<11; j++) { printf("%3d", j ); } printf("\n"); return(0); }...
View Full Document

Ask a homework question - tutors are online