Example:
2 x 1 =2
2 x 2=4
2 x 3=6
2 x 4=8
2 x 5=10

etc

### Sum of 1st 10 Prime Number

WAP to print sum of 1st 10 prime numbers starting from 1.

### Sum of each consequent 5 even number

Print sum for each consequent 5 even numbers starting from 1. The loop will continue up to the 100.

Example of  Output:
Sum: 30 [2,4,6,8,10 are the first 5 even number]
Sum: 90
etc.

### Nesting of for loops : Pyramid Drawing

Nesting of loops, that is, one for statement within another for statement, is allowed in C.

Theme: Inner Loop and Outer Loop Practice Using For in C

Write a C Program to print half pyramid using * as shown in figure below.
` `
```*
* *
* * *
* * * *
* * * * *```

``````
main()
{
int i,j,rows;
printf("Enter the number of rows: ");
scanf("%d",&rows);
for(i=1;i<=rows;++i)
{
for(j=1;j<=i;++j)
{
printf("* ");
}
printf("\n");
}
return 0;
}``````
`` ``
`` ``
`` ``
`` ``
``Print half pyramid using numbers as shown in figure below.``
``````
``````
```1
1 2
1 2 3
1 2 3 4
1 2 3 4 5```
` `
``````main()
{
int i,j,rows;
printf("Enter the number of rows: ");
scanf("%d",&rows);
for(i=1;i<=rows;++i)
{
for(j=1;j<=i;++j)
{
printf("%d ",j);
}
printf("\n");
}
return 0;
}``` ```
` `

`Write a C Program to print triangle of characters as below.`
` `
```A
B B
C C C
D D D D
E E E E E```
` `
``````main()
{
int i,j;
char input,temp='A';
printf("Enter uppercase character you want in triangle at last row: ");
scanf("%c",&input);
for(i=1;i<=(input-'A'+1);++i)
{
for(j=1;j<=i;++j)
printf("%c",temp);
++temp;
printf("\n");
}
return 0;
}``` ```
```
```
`Print inverted half pyramid using * as shown below. `
```
```
```* * * * *
* * * *
* * *
* *
*```
` `
``````main()
{
int i,j,rows;
printf("Enter the number of rows: ");
scanf("%d",&rows);
for(i=rows;i>=1;--i)
{
for(j=1;j<=i;++j)
{
printf("* ");
}
printf("\n");
}
return 0;
}``` ```

`Print inverted half pyramid as using numbers as shown below.`
` `
```1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
```
` `
``````main()
{
int i,j,rows;
printf("Enter the number of rows: ");
scanf("%d",&rows);
for(i=rows;i>=1;--i)
{
for(j=1;j<=i;++j)
{
printf("%d ",j);
}
printf("\n");
}
return 0;
}``` ```
```
```
`C program to print pyramid using *`
` `
```
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *```
` `
`` ``
``````#include <stdio.h>
int main()
{
int i,space,rows,k=0;
printf("Enter the number of rows: ");
scanf("%d",&rows);
for(i=1;i<=rows;++i)
{
for(space=1;space<=rows-i;++space)
{
printf("  ");
}
while(k!=2*i-1)
{
printf("* ");
++k;
}
k=0;
printf("\n");
}
return 0;
}``` ```
` `

C Program to display Floyd's Triangle
```1
2 3
4 5 6
7 8 9 10```
` `
``````#include<stdio.h>
int main()
{
int rows,i,j,k=0;
printf("Enter number of rows: ");
scanf("%d",&rows);
for(i=1;i<=rows;i++)
{
for(j=1;j<=i;++j)
printf("%d ",k+j);
++k;
printf("\n");
}
}``` ```
` `
` `