You are on page 1of 14

ASSIGNMENT #1

NAME:
CH MUHAMMAD BILAL RIAZ
ROLL NO:
012
SECTION:
C
SUBJECT:
PROGRAMMING IN C
Problem no 1

Source code:
#include<stdio.h>
void main ()
{
int r,c;
for(r=1;r<=5;r++)
{
for(c=1;c<=r;c++)
printf("%d",c);
printf("\n");
}
}
Output:
Problem no 2

Source code:
#include<stdio.h>
void main ()
{
int r,c;
for(r=1;r<=5;r++)
{
for(c=1;c<=6-r;c++)
printf("%d",c);
printf("\n");
}

}
Output:
Problem no 3

Source code:
#include<stdio.h>
void main ()
{
int r,c;
for(r=11;r<=15;r++)
{
for(c=11;c<=r;c++)
printf("%d",c);
printf("\n");
}
}

Output:
Problem no 4

Source code:
#include<stdio.h>
void main ()
{
int r,c,b=11;
for(r=1;r<=5;r++)
{
int d=b;
for(c=1;c<=r;c++)
{
printf("%d",d);
d++;
}
b++;
printf("\n");
}
}
Output:
Problem no 5

Source code:
#include<stdio.h>
void main()
{
int r,c;
for(r=1;r<=6;r++)
{
for(c=1;c<=r+5;c++)
{
if(c<=6-r)
printf("*");
else
printf("1");
}
printf("\n");
}
}
Output:
Problem no 6

Source code:
#include<stdio.h>
void main()
{
int r,c;
for(r=6;r>=1;r--)
{
for(c=1;c<=r+5;c++)
{
if(c<=6-r)
printf("*");
else
printf("1");
}
printf("\n");
}
}
Output:
Problem no 7

Source code:
#include<stdio.h>
void main()
{
int r,c,g=11;
for(r=1;r<=6;r++)
{
int h=g;
for(c=1;c<=r;c++)
{
printf("%d",h);
h=h+2;
}
g=g+2;
printf("\n");
}
}
Output:
Problem no 8

Source code:
#include<stdio.h>
void main()
{
int r,c,g=11;
for(r=1;r<=6;r++)
{
int h=g;
for(c=1;c<=r;c++)
{
printf("%d",h);
h=h+r;
}
g=g+2;
printf("\n");
}
}
Output:

You might also like