0% found this document useful (0 votes)
24 views

Conditional Control Structure: (A) Pattern of Numbers I.E. For Input As 5, Following Pattern Should Be Printed

This document outlines objectives and questions for a computer programming lab at Birla Institute of Technology & Science, Pilani. The objectives are to practice conditional control structures by writing programs to print various numeric patterns for a given input. Students are encouraged to discuss logic with instructors rather than just stating a program is not working. The questions include writing programs to: print increasing/decreasing numeric patterns; print a diamond pattern; convert between binary, octal, and decimal numbers; and print multiplication tables for a range of numbers.

Uploaded by

hemanth
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Conditional Control Structure: (A) Pattern of Numbers I.E. For Input As 5, Following Pattern Should Be Printed

This document outlines objectives and questions for a computer programming lab at Birla Institute of Technology & Science, Pilani. The objectives are to practice conditional control structures by writing programs to print various numeric patterns for a given input. Students are encouraged to discuss logic with instructors rather than just stating a program is not working. The questions include writing programs to: print increasing/decreasing numeric patterns; print a diamond pattern; convert between binary, octal, and decimal numbers; and print multiplication tables for a range of numbers.

Uploaded by

hemanth
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Birla Institute of Technology & Science, Pilani

Computer Programming (CSF111)


Second Semester 2014-2015
Lab-6
------------------------------------------------------------------------------------------------------------------ --------------Objectives
Conditional control structure
Today, you are required to implement the following programs yourself. If you face any
problem, you are encouraged to discuss the logic with Lab Instructors. You are
encouraged not to ask the question "MY PROGRAM IS NOT GIVING DESIRED OUTPUT"
or "MY PROGRAM IS SHOWING FOLLOWING ERRORS" with Lab instructors. Rather, ask
the question "MY PROGRAM IS NOT GIVING THE DESIRED OUTPUT, WHAT IS THE WAY
I CAN CORRECT IT".
In a nutshell, you should not only become capable enough to write programs, but also to
find logical/syntactical issues with your programs.
------------------------------------------------------------------------------------------------------------------ --------------Q1. Write a program to print the following patterns:

(a) Pattern of numbers; i.e. for input as 5, following pattern should be printed:
1
12
123
1234
12345
(b) Pattern of numbers; i.e. for input as 5, following pattern should be printed:
1
12
123
1234
12345
1234
123
12
1
(c) Diamond pattern; i.e. for input as 5, following pattern should be printed.
*
***
*****
*******
*********
*******
*****
***
*

(d) Pattern of numbers; i.e. for input as 5, following pattern should be printed:
12345
1234
123
12
1
12
123
1234
12345
Q2. Write a C program to convert binary number to octal number.
Q3. Write a program to convert binary to decimal number.
Q4. Write a program to take two numbers (n and m) as input from the user and print the multiplication
tables of numbers from n to m (both inclusive).

You might also like