Professional Documents
Culture Documents
ICTC S12/ICTC S14: Fundamentals of Computing: 2 Semester SY 2017-2018
ICTC S12/ICTC S14: Fundamentals of Computing: 2 Semester SY 2017-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%