Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

ICTC S12/ICTC S14: Fundamentals of Computing Name ____DUBLA, JHALEA FAYE O.

________

Learning Activity No. 2 Strand/Section____STEM-E11A___________

Date ___January 5, 2018____

I. Write a program in C to make such a pattern like right angle triangle with number increased by 1. The
pattern is as follows : (For Loop)

1
23
456
7 8 9 10
Code: Output:
#include <stdio.h>
void main()
{
int i,j,rows,k=1;
printf("Input number of rows : ");
scanf("%d",&rows);
for(i=1;i<=rows;i++)
{
for(j=1;j<=i;j++)
printf("%d ",k++);
printf("\n");
}
}

II. Write a C program to print the multiplication table of 7 from 1 to 10. (Do…While Loop)

Code: Output:
#include <stdio.h>

int main() {
int num = 7, value, i;
printf("Multiplication Table for %d :-\n", num);
i = 1; /* initialization */
do {
value = num * i;
printf("%d * %d = %d\n", num, i, value);
i++; /* increment */
} while ( i <= 10 ); /* condition check for exit */
return 0;
}

Rubrics:
Codes – 60%
Execution – 40%
TOTAL = 100%

2nd Semester SY 2017-2018


2nd Semester SY 2017-2018

You might also like