List of C Programming Looping
List of C Programming Looping
1.
2.
3.
4.
5.
C
C
C
C
C
program
program
program
program
program
to
to
to
to
to
32.
33. }
return 0;
34. Decimal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
cnt=0;
/*initialize index to zero*/
while(number>0)
{
oct[cnt]=number%8;
number=number/8;
cnt++;
}
/*print value in reverse order*/
printf("Octal value is: ");
for(i=(cnt-1); i>=0;i--)
printf("%d",oct[i]);
return 0;
}
**
***
5
6
7
****
*****
*/
8
9
10
#include<stdio.h>
#define MAX 5
11
12
13
14
int main()
{
int i,j;
15
16
for(i=0; i< MAX; i++)
17
18
for(j=0;j<=i;j++)
19
20
printf("*");
21
22
printf("\n");
23
24
25
return 0;
}
26
*
**
***
****
*****
Program - 2
1
*****
****
***
5
6
7
**
*
*/
8
9
#include<stdio.h>
10
11
#define MAX 5
12
13
14
int main()
{
15
int i,j;
16
17
18
19
for(j=0;j<=i;j++)
20
{
printf("*");
21
}
22
printf("\n");
23
}
24
return 0;
25
26
*****
****
***
**
*
Program - 3
1
* *
* * *
* * * *
* * * * *
6
7
*/
8
#include<stdio.h>
9
10
#define MAX 5
11
12
13
14
int main()
{
int i,j;
15
int space=4;
16
17
for(i=0;i< MAX;i++)
18
19
20
for(j=0;j< space;j++)
21
{
printf(" ");
22
23
24
25
}
for(j=0;j<=i;j++)
{
printf("* ");
26
27
28
29
printf("\n");
30
space--;
31
32
return 0;
33
34
*
**
***
****
*****
3. C program to find Smallest and Largest elements from One Dimensional Array
Elements.
4. C program to replace all EVEN elements by 0 and Odd by 1 in One Dimensional
Array.
5. C program to merge Two One Dimensional Arrays elements.
6. C program to Add and Subtract of Two One Dimensional Array elements.
7. C program to find a number from array elements.
8. C program to sort array elements in ascending order.
9. C program to reverse array element.
10. C program to swap adjacent elements of a one dimensional array
11. C program to find occurrence of an element in one dimensional array.
12. C program to sort an one dimensional array in ascending order.
13. C program to sort an one dimensional array in descending order.
14. C program to delete given element from one dimensional array.
15. C program to create array with reverse elements of one dimensional array.
c
c
c
c
c
c
c
program
program
program
program
program
program
program
to
to
to
to
to
to
to
read and print a rxc matrix, r and c must be input by the user.
read a matrix and find sum and product of all elements.
find sum of all elements of each row of a matrix.
transpose a matrix.
read a matrix and print diagonals.
find sum and subtraction of two matrices.
find multiplication of two matrices
program to create, declare and initialize structure. program to read and print an
employee's detail using structure. program to demonstrate example of nested
structure.program to demonstrate example structure pointer (structure with
pointer).program to demonstrate example structure pointer (structure with pointer)
using user define function.program to declare, initialize an union, example of
unionprogram to demonstrate example of structure of array. program to add two
distances in feet and inches using structure.
Program to create, open and close a file.
Program to write text (characters) into file and print.
program to print given number of lines of a file (like head command in Linux).
program to print contents in reverse order of a file (just like TAC command in Linux).
program to compare contents of two files.
program to copy number of bytes of from a specific offset to another file.
C - Read Content of a File using getc() using C Program.
(From C Code Snippet Section)