1. Write a program that prints the following text at the terminal.
· In C, lowercase letters are significant.
·
main is where program execution begins.
·
Opening and closing braces enclose program
statements in a routine.
·
All program statements must be terminated by a
semicolon.
2. Print the following shapes.
*
* *
* * *
* * * *
* * * * *
* * * * * *
#include<stdio.h>
int main(){
printf("*\n");
printf("**\n");
printf("***\n");
printf("****\n");
printf("*****\n");
printf("******\n");
return
0;
}
* * * * * *
* * * * *
* * * *
* * *
* *
*
#include<stdio.h>
int main(){
printf("******\n");
printf("*****\n");
printf("****\n");
printf("***\n");
printf("**\n");
printf("*");
return
0;
}
* * * * *
* * * *
* * *
* *
*
#include<stdio.h>
int main(){
printf("******\n");
printf("
*****\n");
printf(" ****\n");
printf(" ***\n");
printf(" **\n");
printf(" *");
return
0;
}
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
#include<stdio.h>
int main(){
printf("******\n");
printf("******\n");
printf("******\n");
printf("******\n");
printf("******\n");
return
0;
}
*
* *
* * *
* * * *
* * * * *
* * * * * *
#include<stdio.h>
int main(){
printf(" *\n");
printf(" **\n");
printf(" ***\n");
printf(" ****\n");
printf("
*****\n");
printf("******");
return
0;
}
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
#include<stdio.h>
int main(){
printf("1\n");
printf("12\n");
printf("123\n");
printf("1234\n");
printf("12345\n");
return
0;
}
#include<stdio.h>
int main(){
printf("Name: K.L.Lapalu
Sathdula Liyanage");
printf("BOD:
12/02/2001\n");
printf("School: Saranath
College Kuliyapitiya\n");
printf("Address:
Koongollawatte,Kuliyapitiya\n");
printf("Education: Ordinary
Level = Pass | Advanced Level = Pass\n");
printf("Email:
lapaluliyanage@gmail.com");
return 0;
}
4. What
output would you expect from the following program?
#include
<stdio.h>
int main (void)
{
printf
("Testing...");
printf
("....1");
printf
("...2");
printf
("..3");
printf
("\n");
return 0;
Output:
Testing.......1...2..3
Post a Comment