SlideShare a Scribd company logo
Simple C Program :
Program :
/* Simple C Program .
Creation Date : 12:34 PM 07/11/2010
Author : R.K.Singh*/
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
printf("n My first program in C !");
getch();
}
Output :
My first program in C !_
Program to print value of existing
number :
Program :
/* Program to print value of existing number .
Creation Date : 12:38 PM 07/11/2010
Author :R.K.Singh */
#include <stdio.h>
#include <conio.h>
void main()
{
int no = 19;
clrscr();
printf("n Number is : %d",no);
getch();
}
Output :
Number is : 19 !_
Program to demonstrate scanf()
and printf() : 3.C :
Program :
/* Program to demonstrate scanf() and printf().
Creation Date : 12:41 PM 07/11/2011
Author : R.K.Singh */
#include <stdio.h>
#include <conio.h>
void main()
{
int no;
clrscr();
printf("n Enter any number :");
scanf("%d",&no);
printf("n Number is : %d",no);
getch();
}
Output :
Enter any number :12
Number is : 12_
Operators
Program to calculate addition of two
numbers :
Program :
/* Program to calculate addition of two numbers.
Creation Date : 09:51 PM 21/11/2011
Author : R.K.Singh */
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c;
clrscr();
printf("n Enter any 2 numbers : ");
scanf("%d %d",&a,&b);
c = a + b;
printf("n Addition is : %d",c);
getch();
}
Output :
Enter any 2 numbers : 12 14
Addition is : 26_
Program to calculate subtraction of two
numbers :
/* Program to calculate subtraction of two numbers.
Creation Date : 10:43 PM 21/11/2011
Author : R.K.Singh */
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c;
clrscr();
printf("n Enter any 2 numbers : ");
scanf("%d %d",&a,&b);
c = a - b;
printf("n Subtraction is : %d",c);
getch();
}
Output :
Enter any 2 numbers : 8 6
Subtraction is : 2_
Program to calculate division of two
numbers :
Program :
/* Program to calculate division of two numbers.
Creation Date : 10:58 PM 21/11/2011
Author : R.K.Singh */
#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,c;
clrscr();
printf("n Enter any 2 numbers : ");
scanf("%d %d",&a,&b);
c = a / b;
printf("n Division is : %d",c);
getch();
}
Output :
Enter any 2 numbers : 12 5
Division is : 2_
Program to calculate multiplication of
two numbers :
• Program :
• /* Program to calculate multiplication of two numbers.
• Creation Date : 10:51 PM 21/11/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int a,b,c;
• clrscr();
• printf("n Enter any 2 numbers : ");
• scanf("%d %d",&a,&b);
• c = a * b;
• printf("n Multiplication is : %d",c);
• getch();
• }
Output :
Enter any 2 numbers : 8 12
Multiplication is : 96_
Program to calculate modulus of two
numbers :
• Program :
• /* Program to calculate modulus of two numbers.
• Creation Date : 11:01 PM 21/11/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int a,b,c;
• clrscr();
• printf("n Enter any 2 numbers : ");
• scanf("%d %d",&a,&b);
• c = a % b;
• printf("n Modulus is : %d",c);
• getch();
• }
Output :
Enter any 2 numbers : 11 5
Modulus is : 1_
Pyramid in c
Program to print pyramid in C :
Pattern 1 :
• Program :
• /* Program to print pyramid pattern in C : Pattern 1
• Creation Date : 12:36 AM 22/11/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i,j;
• clrscr();
• for(i=0; i<5; i++)
• {
• for(j=0; j<5; j++)
• {
• printf(" * ");
• }
• printf("n");
• }
• getch();
• }
Output :
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *_
Program to print pyramid in C :
Pattern 2 :
• Program :
• /* Program to print pyramid pattern in C : Pattern 2
• Creation Date : 12:43 AM 22/11/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i,j;
• clrscr();
• for(i=0; i<5; i++)
• {
• for(j=0; j<=i; j++)
• {
• printf(" * ");
• }
• printf("n");
• }
• getch();
• }
Output :
*
* *
* * *
* * * *
* * * * *_
Program to print pyramid in C :
Pattern 3 :• /* Program to print pyramid pattern in C : Pattern 3
• Creation Date : 12:28 AM 22/11/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i,j,k;
• clrscr();
• for(i=1; i<=5; i++)
• {
• for(j=5; j>=i; j--)
• {
• printf(" ");
• }
• for(k=1; k<=i; k++)
• {
• printf("*");
• }
• printf("n");
• }
• getch();
• }
Output :
*
* *
* * *
* * * *
* * * * *_
Program to print pyramid in C :
Pattern 4 :• /* Program to print pyramid pattern in C : Pattern 4
• Creation Date : 12:54 AM 22/11/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i,j,k,samp=1;
• clrscr();
• for(i=5; i>=1; i--)
• {
• for(k=samp; k>=0; k--)
• {
• printf(" "); // only 1 space
• }
• for(j=i; j>=1; j--)
• {
• printf("*");
• }
• samp = samp + 1;
• printf("n");
• }
• getch();
• }
Output :
* * * * *
* * * *
* * *
* *
*_
Program to print pyramid in C :
Pattern 5 :
• Program :
• /* Program to print pyramid pattern in C : Pattern 5
• Creation Date : 01:08 AM 22/11/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i,j;
• clrscr();
• for(i=5; i>=1; i--)
• {
• for(j=1; j<=i; j++)
• {
• printf(" * ");
• }
• printf("n");
• }
• getch();
• }
Output :
* * * * *
* * * *
* * *
* *
*_
Program to print pyramid in C :
Pattern 6 :
• Program :
• /* Program to print pyramid pattern in C : Pattern 6
• Creation Date : 01:52 AM 22/11/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i,j,k,t=0;
• clrscr();
• for(i=1; i<=5; i++)
• {
• for(k=t; k<5; k++)
• {
• printf(" ");
• }
• for(j=0; j< i; j++)
• {
• printf(" * ");
• t = t + 1;
• }
• printf("n");
• }
• getch();
• }
Output :
*
* *
* * *
* * * *
* * * * *_
Program to print pyramid in C :
Pattern 7 :• Program :
• /* Program to print pyramid pattern in C : Pattern 7
• Creation Date : 01:13 AM 22/11/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i,j,k,samp=1;
• clrscr();
• for(i=1; i<=5; i++)
• {
• for(k=samp; k<=5; k++)
• {
• printf(" ");
• }
• for(j=0; j< i; j++)
• {
• printf("*");
• }
• samp = samp + 1;
• printf("n");
• }
• samp = 1;
• for(i=4; i>=1; i--)
• {
• for(k=samp; k>=0; k--)
• {
• printf(" ");
• }
• for(j=i; j>=1; j--)
• {
• printf("*");
• }
• samp = samp + 1;
• printf("n");
• }
• getch();
• }
•
Output :
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*_
Program to print pyramid in C :
Pattern 8 :
• Program :
• /* Program to print pyramid pattern in C : Pattern 8
• Creation Date : 02:39 PM 01/10/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int rw, c, no=1 ,len;
• clrscr();
• printf("Enter number of rows: ");
• scanf("%d," &len);
• for(rw=1; rw<=len; rw++)
• {
• printf("n");
• for(c=1; c<=rw; c++)
• {
• printf(" %2d ", no);
• no++;
• }
• }
• getch();
• }
Output :
Enter number of rows: 5
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15_
Program to print pyramid in C :
Pattern 9 :• Program :
• /* Program to print pyramid pattern in C : Pattern 9
• Creation Date : 03:19 PM 01/10/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int no,i,y,x=35;
• clrscr();
• printf("Enter number of rows: ");
• scanf("%d," &no);
• for(y=0;y<=no;y++)
• {
• goto(x,y+1);
• for(i=0-y; i<=y; i++)
• {
• printf(" %3d ", abs(i));
• x=x-3;
• }
• }
• getch();
• }
Output :
Enter number of rows: 5
0
1 0 1
2 1 0 1 2
3 2 1 0 1 2 3
4 3 2 1 0 1 2 3 4
5 4 3 2 1 0 1 2 3 4 5_
Program to print pyramid in C :
Pattern 10 :
• Program :
• /* Program to print pyramid pattern in C : Pattern 10
• Creation Date : 03:14 PM 01/10/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i, j=5, k, x;
• clrscr();
• for(i=1;i<=5;i++)
• {
• for(k=1;k<=j;k++)
• {
• printf(" ");
• }
• for(x=1;x<=i;x++)
• {
• printf("%d",i);
• printf(" ");
• }
• printf("n");
• j=j-1;
• }
• getch();
• }
Output :
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5_
Program to print pyramid in C :
Pattern 11 :• Program :
• /* Program to print pyramid pattern in C : Pattern 11
• Creation Date : 03:24 PM 01/10/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int rw,c,no,spc;
• clrscr();
• printf("Enter number of rows : ");
• scanf("%d", &no);
• for(rw=1; rw<=no; rw++)
• {
• for(spc=no; spc>=rw; spc--)
• {
• printf(" ");
• }
• for(c=1; c<=rw; c++)
• {
• printf("%2d",c);
• }
• printf("n");
• }
• getch();
• }
Output :
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5_
Program to print pyramid in C :
Pattern 12 :
• Program :
• /* Program to print pyramid pattern in C : Pattern 12
• Creation Date : 03:24 PM 01/10/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i,j,k;
• clrscr();
• for(i=1; i<=5; i++)
• {
• for(j=1; j<=5-i; j++)
• {
• printf(" ");
• }
• for(k=1; k<=2*i-1; k++)
• {
• printf(" %d ",k);
• }
• printf("n");
• }
• getch();
• }
Output :
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9_
Program to print pyramid in C :
Pattern 13 :
• Program :
• /* Program to print pyramid pattern in C : Pattern 13
• Creation Date : 04:24 PM 01/10/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• int i,j,asci,spc;
• clrscr();
• for(i=7; i>=1; i--)
• {
• for(spc=6; spc>=i; spc--)
• {
• printf(" ");
• }
• asci=65;
• for(j=1; j<=i; j++)
• {
• printf("%2c",asci++);
• }
• for(j=i-1; j>=0; j--)
• {
• printf("%2c",--asci);
• }
• printf("n");
• }
• getch();
• }
Output :
A B C D E F G G F E D C B A
A B C D E F F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A_
Program to all Combinations of
characters A,B,C in C : Pattern 14 :
• Program :
• /* Program to print all Combinations of characters
A, B, C : Pattern 14
• Creation Date : 11:33 PM 01/10/2011
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
• void main()
• {
• char ch1, ch2, ch3;
• clrscr();
• for(ch1='A' ; ch1<='C' ; ++ch1)
• {
• for(ch2='A' ; ch2<='C' ; ++ch2)
• {
• for(ch3='A' ; ch3<='C' ; ++ch3)
• {
• printf(" %c%c%c", ch1, ch2, ch3);
• }
• }
• }
• getch();
• }
Output :
AAA AAB AAC ABA ABB ABC ACA ACB ACC BAA BAB BAC BBA BBB
BBC BCA BCB BCC CAA CAB CAC CBA CBB CBC CCA CCB CCC_
Addition of two matrices :
Program :
/* Program to demonstrate addition of two matrices. Creation Date : 25 Nov 2011 11:35:00 PM
Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
•
• void main()
• {
• int a[3][3],b[3][3],c[3][3],i,j;
• clrscr();
• printf("nt Enter First Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&a[i][j]);
• }
• }
• printf("nt Enter Second Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&b[i][j]);
• }
• }
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• c[i][j]=a[i][j]+b[i][j];
• }
• }
• printf("nt Matrix Addition is : nn");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• printf("t %d",c[i][j]);
• }
• printf("n");
• }
• getch();
• }
Output :
Enter First Matrix : 2 1 2
3 2 1
2 3 3
Enter Second Matrix : 2 1 0
2 3 0
1 1 2
Matrix Addition is :
4 2 2
5 5 1
3 4 5_
Subtraction of two matrices :
• Program :
•
• /* Program to demonstrate subtraction of two matrices.
• Creation Date : 25 Nov 2011 11:42:08 PM
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
•
• void main()
• {
• int a[3][3],b[3][3],c[3][3],i,j;
• clrscr();
• printf("nt Enter First Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&a[i][j]);
• }
• }
• printf("nt Enter Second Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&b[i][j]);
• }
• }
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• c[i][j]=a[i][j]-b[i][j];
• }
• }
• printf("nt Matrix Subtraction is : nn");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• printf("t %d",c[i][j]);
• }
• printf("n");
• }
• getch();
• }
Output :
Enter First Matrix : 2 1 2
3 2 1
2 3 3
Enter Second Matrix : 2 1 0
2 3 0
1 1 2
Matrix Subtraction is :
0 0 2
1 -1 1
1 2 1_
Multiplication of two matrices :• Program :
• /* Program to demonstrate multiplication of two matrices.
Creation Date : 25 Nov 2011 11:50:11 PM
Author : R.K.Singh */
#include <stdio.h>
• #include <conio.h>
• void main()
• {
• int a[3][3],b[3][3],c[3][3],i,j,k;
• clrscr();
• printf("nt Enter First Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&a[i][j]);
• }
• }
• printf("nt Enter Second Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&b[i][j]);
• }
• }
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• c[i][j]=0;
• for(k=0;k<3;k++)
• {
• c[i][j]=c[i][j]+a[i][k]*b[k][j];
• }
• }
• }
• printf("nt Matrix Multiplication is : nn");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• printf("t %d",c[i][j]);
• }
• printf("n");
• }
• getch();
• }
Output :
Enter First Matrix : 1 2 1
3 2 1
1 2 1
Enter Second Matrix : 3 3 3
1 2 1
1 1 1
Matrix Multiplication is :
6 8 6
12 14 12
6 8 6_
Transpose of matrix :• Program :
•
• /* Program to demonstrate transpose of matrix.
• Creation Date : 26 Nov 2011 12:03:59 PM
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
•
• void main()
• {
• int a[3][3],i,j;
• clrscr();
• printf("nt Enter Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&a[i][j]);
• }
• }
• printf("nt Transpose of Matrix is : nn");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• printf("t%d",a[j][i]);
• }
• printf("n");
• }
• getch();
• }
Output :
Enter Matrix : 2 1 2
3 2 1
2 3 3
Transpose of Matrix is :
2 3 2
1 2 3
2 1 3_
Check matrix is lower triangular or not :
• Program :
•
• /* Program to check lower triangular matrix or not.
• Creation Date : 26 Nov 2011 01:14:54 PM
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
•
• void main()
• {
• int a[3][3],i,j,flg=0;
• clrscr();
• printf("nt Enter 3*3 Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&a[i][j]);
• }
• }
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• if(a[i]<a[j] && a[i][j]==0)
• {
• flg=flg+1;
• }
• }
• }
• if(flg==3)
• printf("nn Lower triangular matrix !");
• else
• printf("nn Not lower triangular matrix !");
• getch();
• }
Output :
Enter 3*3 Matrix :
1 0 0
1 1 0
2 2 3
Lower triangular matrix !_
Check matrix is upper triangular or not :
• Program :
•
• /* Program to check upper triangular matrix or not.
• Creation Date : 26 Nov 2011 01:14:54 PM
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
•
• void main()
• {
• int a[3][3],i,j,flg=0;
• clrscr();
• printf("nt Enter 3*3 Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&a[i][j]);
• }
• }
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• if(a[i]>a[j] && a[i][j]==0)
• {
• flg=flg+1;
• }
• }
• }
• if(flg==3)
• printf("nn Upper triangular matrix !");
• else
• printf("nn Not Upper triangular matrix !");
• getch();
• }
Output :
Enter 3*3 Matrix :
1 2 3
0 1 1
0 0 3
Upper triangular matrix !_
Check matrix is unit/identity matrix or not :
• Program :
•
• /* Program to check unit/identity matrix or not.
• Creation Date : 26 Nov 2011 08:28:08 PM
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
•
• void main()
• {
• int a[3][3],i,j,flg=0,flg2=0,flg3=0;
• clrscr();
• printf("nt Enter 3*3 Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&a[i][j]);
• }
• }
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• if(a[i]<a[j] && a[i][j]==0)
• {
• flg=flg+1;
• }
• if(a[i]>a[j] && a[i][j]==0)
• {
• flg2=flg2+1;
• }
• if(a[i][j]==1)
• {
• flg3=flg3+1;
• }
• }
• }
• if(flg==3 && flg2==3 && flg3==3)
• printf("nn Unit/Identity matrix !");
• else
• printf("nn Not Unit/Identity matrix !");
• getch();
• }
Output :
Enter 3*3 Matrix :
1 0 0
0 1 0
0 0 1
Unit/Identity matrix !_
Check matrix is zero/null matrix or not :
• Program :
•
• /* Program to check zero/null matrix or not.
• Creation Date : 26 Nov 2011 02:09:04 PM
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
•
• void main()
• {
• int a[3][3],i,j,flg=0;
• clrscr();
• printf("nt Enter 3*3 Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&a[i][j]);
• }
• }
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• if(a[i][j]==0)
• {
• flg=flg+1;
• }
• }
• }
• if(flg==9)
• printf("nn Zero/Null matrix !");
• else
• printf("nn Not Zero/Null matrix !");
• getch();
• }
Output :
Enter 3*3 Matrix :
0 0 0
0 0 0
0 0 0
Zero/Null matrix !_
Check matrix is diagonal or not :
• Program :
•
• /* Program to check diagonal matrix or not.
• Creation Date : 26 Nov 2011 01:14:54 PM
• Author : R.K.Singh */
• #include <stdio.h>
• #include <conio.h>
•
• void main()
• {
• int a[3][3],i,j,flg=0,flg2=0;
• clrscr();
• printf("nt Enter 3*3 Matrix : ");
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• scanf("%d",&a[i][j]);
• }
• }
• for(i=0;i<3;i++)
• {
• for(j=0;j<3;j++)
• {
• if(a[i]<a[j] && a[i][j]==0)
• {
• flg=flg+1;
• }
• if(a[i]>a[j] && a[i][j]==0)
• {
• flg2=flg2+1;
• }
• }
• }
• if(flg==3 && flg2==3)
• printf("nn Diagonal matrix !");
• else
• printf("nn Not Diagonal matrix !");
• getch();
• }
•
Output :
Enter 3*3 Matrix :
2 0 0
0 5 0
0 0 1
Diagonal matrix !_

More Related Content

What's hot

RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
v_jk
 
Presentation on nesting of loops
Presentation on nesting of loopsPresentation on nesting of loops
Presentation on nesting of loopsbsdeol28
 
Modular programming
Modular programmingModular programming
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
JAYA
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
Sathish Narayanan
 
Phonebook Directory or Address Book In Android
Phonebook Directory or Address Book In AndroidPhonebook Directory or Address Book In Android
Phonebook Directory or Address Book In Android
ABHISHEK DINKAR
 
Control structures repetition
Control structures   repetitionControl structures   repetition
Control structures repetition
Online
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
Komal Kotak
 
Prsentation on functions
Prsentation on functionsPrsentation on functions
Prsentation on functionsAlisha Korpal
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)indrasir
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
Sowmya Jyothi
 
Nested structure (Computer programming and utilization)
Nested structure (Computer programming and utilization)Nested structure (Computer programming and utilization)
Nested structure (Computer programming and utilization)
Digvijaysinh Gohil
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programming
CHANDAN KUMAR
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
Haard Shah
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
Mushiii
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
Tarun Sharma
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ pptKumar
 
6 operators-in-c
6 operators-in-c6 operators-in-c
6 operators-in-c
Rohit Shrivastava
 

What's hot (20)

RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
C lab-programs
C lab-programsC lab-programs
C lab-programs
 
Presentation on nesting of loops
Presentation on nesting of loopsPresentation on nesting of loops
Presentation on nesting of loops
 
Modular programming
Modular programmingModular programming
Modular programming
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Phonebook Directory or Address Book In Android
Phonebook Directory or Address Book In AndroidPhonebook Directory or Address Book In Android
Phonebook Directory or Address Book In Android
 
Control structures repetition
Control structures   repetitionControl structures   repetition
Control structures repetition
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
 
Prsentation on functions
Prsentation on functionsPrsentation on functions
Prsentation on functions
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
 
Nested structure (Computer programming and utilization)
Nested structure (Computer programming and utilization)Nested structure (Computer programming and utilization)
Nested structure (Computer programming and utilization)
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programming
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
 
6 operators-in-c
6 operators-in-c6 operators-in-c
6 operators-in-c
 

Viewers also liked

Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
avikdhupar
 
C program
C programC program
C program
Shaik JaniBasha
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomesh
praveensomesh
 
Lab. Programs in C
Lab. Programs in CLab. Programs in C
Lab. Programs in C
Saket Pathak
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
Mainak Sasmal
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
Gradeup
 
نماذج جوجل
نماذج جوجلنماذج جوجل
نماذج جوجل
Wael Awwad
 
Microsoft word -_microsoft_word_exercise
Microsoft word -_microsoft_word_exerciseMicrosoft word -_microsoft_word_exercise
Microsoft word -_microsoft_word_exerciseSubeesh Up
 
Programming with c language practical manual
Programming with c language practical manualProgramming with c language practical manual
Programming with c language practical manual
Anil Bishnoi
 
Beginners: Microsoft Office Word 2007 Lesson 2
Beginners: Microsoft Office Word 2007 Lesson 2Beginners: Microsoft Office Word 2007 Lesson 2
Beginners: Microsoft Office Word 2007 Lesson 2
adultref
 
Word exercises (1)
Word exercises (1)Word exercises (1)
Word exercises (1)
ruelcdogma
 
Microsoft word exercises
Microsoft word exercisesMicrosoft word exercises
Microsoft word exercisesSubeesh Up
 
Metal Joining Processes: Welding, Riveting, Bolting, Brazing, Soldering
Metal Joining Processes: Welding, Riveting, Bolting, Brazing, SolderingMetal Joining Processes: Welding, Riveting, Bolting, Brazing, Soldering
Metal Joining Processes: Welding, Riveting, Bolting, Brazing, Soldering
JJ Technical Solutions
 
C programming project by navin thapa
C programming project by navin thapaC programming project by navin thapa
C programming project by navin thapaNavinthp
 
C programming Lab Manual 15 me47p
C programming Lab Manual 15 me47p C programming Lab Manual 15 me47p
C programming Lab Manual 15 me47p
THANMAY JS
 
Intro to Microsoft Word 2010 for Kids
Intro to Microsoft Word 2010 for Kids Intro to Microsoft Word 2010 for Kids
Intro to Microsoft Word 2010 for Kids
Queens Library
 
basics of computer system ppt
basics of computer system pptbasics of computer system ppt
basics of computer system ppt
Suaj
 
Microsoft word presentation
Microsoft word presentationMicrosoft word presentation
Microsoft word presentationegirshovich
 

Viewers also liked (20)

Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
C program
C programC program
C program
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomesh
 
Lab. Programs in C
Lab. Programs in CLab. Programs in C
Lab. Programs in C
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
 
نماذج جوجل
نماذج جوجلنماذج جوجل
نماذج جوجل
 
Microsoft word -_microsoft_word_exercise
Microsoft word -_microsoft_word_exerciseMicrosoft word -_microsoft_word_exercise
Microsoft word -_microsoft_word_exercise
 
Programming with c language practical manual
Programming with c language practical manualProgramming with c language practical manual
Programming with c language practical manual
 
Beginners: Microsoft Office Word 2007 Lesson 2
Beginners: Microsoft Office Word 2007 Lesson 2Beginners: Microsoft Office Word 2007 Lesson 2
Beginners: Microsoft Office Word 2007 Lesson 2
 
Word exercises (1)
Word exercises (1)Word exercises (1)
Word exercises (1)
 
Microsoft word exercises
Microsoft word exercisesMicrosoft word exercises
Microsoft word exercises
 
Metal Joining Processes: Welding, Riveting, Bolting, Brazing, Soldering
Metal Joining Processes: Welding, Riveting, Bolting, Brazing, SolderingMetal Joining Processes: Welding, Riveting, Bolting, Brazing, Soldering
Metal Joining Processes: Welding, Riveting, Bolting, Brazing, Soldering
 
C programming project by navin thapa
C programming project by navin thapaC programming project by navin thapa
C programming project by navin thapa
 
C ppt
C pptC ppt
C ppt
 
C programming Lab Manual 15 me47p
C programming Lab Manual 15 me47p C programming Lab Manual 15 me47p
C programming Lab Manual 15 me47p
 
Intro to Microsoft Word 2010 for Kids
Intro to Microsoft Word 2010 for Kids Intro to Microsoft Word 2010 for Kids
Intro to Microsoft Word 2010 for Kids
 
Introduction to microsoft word 2007
Introduction to microsoft word 2007Introduction to microsoft word 2007
Introduction to microsoft word 2007
 
basics of computer system ppt
basics of computer system pptbasics of computer system ppt
basics of computer system ppt
 
Microsoft word presentation
Microsoft word presentationMicrosoft word presentation
Microsoft word presentation
 

Similar to Simple c program

Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)
Jaydip JK
 
pattern-printing-in-c.pdf
pattern-printing-in-c.pdfpattern-printing-in-c.pdf
pattern-printing-in-c.pdf
RSathyaPriyaCSEKIOT
 
Computer Networks Lab File
Computer Networks Lab FileComputer Networks Lab File
Computer Networks Lab File
Kandarp Tiwari
 
Friend this-new&delete
Friend this-new&deleteFriend this-new&delete
Friend this-new&delete
Shehzad Rizwan
 
C Programming
C ProgrammingC Programming
C Programming
Sumant Diwakar
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
Ashishchinu
 
Pioc
PiocPioc
Pioc
Tom Sun
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
PRATHAMESH DESHPANDE
 
Linux_C_LabBasics.ppt
Linux_C_LabBasics.pptLinux_C_LabBasics.ppt
Linux_C_LabBasics.ppt
CharuJain396881
 
Hargun
HargunHargun
RDataMining slides-r-programming
RDataMining slides-r-programmingRDataMining slides-r-programming
RDataMining slides-r-programming
Yanchang Zhao
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
walia Shaan
 
C Programming Training in Ambala ! Batra Computer Centre
C Programming Training in Ambala ! Batra Computer CentreC Programming Training in Ambala ! Batra Computer Centre
C Programming Training in Ambala ! Batra Computer Centre
jatin batra
 
Cd practical file (1) start se
Cd practical file (1) start seCd practical file (1) start se
Cd practical file (1) start se
dalipkumar64
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
premrings
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
Zaibi Gondal
 
A Replay Approach to Software Validation
A Replay Approach to Software ValidationA Replay Approach to Software Validation
A Replay Approach to Software ValidationJames Pascoe
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singh
DIVYA SINGH
 

Similar to Simple c program (20)

Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)
 
pattern-printing-in-c.pdf
pattern-printing-in-c.pdfpattern-printing-in-c.pdf
pattern-printing-in-c.pdf
 
Computer Networks Lab File
Computer Networks Lab FileComputer Networks Lab File
Computer Networks Lab File
 
Friend this-new&delete
Friend this-new&deleteFriend this-new&delete
Friend this-new&delete
 
Graphics Programming in C
Graphics Programming in CGraphics Programming in C
Graphics Programming in C
 
C Programming
C ProgrammingC Programming
C Programming
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
Pioc
PiocPioc
Pioc
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
Linux_C_LabBasics.ppt
Linux_C_LabBasics.pptLinux_C_LabBasics.ppt
Linux_C_LabBasics.ppt
 
Hargun
HargunHargun
Hargun
 
C
CC
C
 
RDataMining slides-r-programming
RDataMining slides-r-programmingRDataMining slides-r-programming
RDataMining slides-r-programming
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
 
C Programming Training in Ambala ! Batra Computer Centre
C Programming Training in Ambala ! Batra Computer CentreC Programming Training in Ambala ! Batra Computer Centre
C Programming Training in Ambala ! Batra Computer Centre
 
Cd practical file (1) start se
Cd practical file (1) start seCd practical file (1) start se
Cd practical file (1) start se
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
A Replay Approach to Software Validation
A Replay Approach to Software ValidationA Replay Approach to Software Validation
A Replay Approach to Software Validation
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singh
 

Recently uploaded

MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Landownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptxLandownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptx
JezreelCabil2
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Ashish Kohli
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 

Recently uploaded (20)

MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Landownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptxLandownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptx
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 

Simple c program

  • 1. Simple C Program : Program : /* Simple C Program . Creation Date : 12:34 PM 07/11/2010 Author : R.K.Singh*/ #include <stdio.h> #include <conio.h> void main() { clrscr(); printf("n My first program in C !"); getch(); }
  • 2. Output : My first program in C !_
  • 3. Program to print value of existing number : Program : /* Program to print value of existing number . Creation Date : 12:38 PM 07/11/2010 Author :R.K.Singh */ #include <stdio.h> #include <conio.h> void main() { int no = 19; clrscr(); printf("n Number is : %d",no); getch(); }
  • 5. Program to demonstrate scanf() and printf() : 3.C : Program : /* Program to demonstrate scanf() and printf(). Creation Date : 12:41 PM 07/11/2011 Author : R.K.Singh */ #include <stdio.h> #include <conio.h> void main() { int no; clrscr(); printf("n Enter any number :"); scanf("%d",&no); printf("n Number is : %d",no); getch(); }
  • 6. Output : Enter any number :12 Number is : 12_
  • 8. Program to calculate addition of two numbers : Program : /* Program to calculate addition of two numbers. Creation Date : 09:51 PM 21/11/2011 Author : R.K.Singh */ #include <stdio.h> #include <conio.h> void main() { int a,b,c; clrscr(); printf("n Enter any 2 numbers : "); scanf("%d %d",&a,&b); c = a + b; printf("n Addition is : %d",c); getch(); }
  • 9. Output : Enter any 2 numbers : 12 14 Addition is : 26_
  • 10. Program to calculate subtraction of two numbers : /* Program to calculate subtraction of two numbers. Creation Date : 10:43 PM 21/11/2011 Author : R.K.Singh */ #include <stdio.h> #include <conio.h> void main() { int a,b,c; clrscr(); printf("n Enter any 2 numbers : "); scanf("%d %d",&a,&b); c = a - b; printf("n Subtraction is : %d",c); getch(); }
  • 11. Output : Enter any 2 numbers : 8 6 Subtraction is : 2_
  • 12. Program to calculate division of two numbers : Program : /* Program to calculate division of two numbers. Creation Date : 10:58 PM 21/11/2011 Author : R.K.Singh */ #include <stdio.h> #include <conio.h> void main() { int a,b,c; clrscr(); printf("n Enter any 2 numbers : "); scanf("%d %d",&a,&b); c = a / b; printf("n Division is : %d",c); getch(); }
  • 13. Output : Enter any 2 numbers : 12 5 Division is : 2_
  • 14. Program to calculate multiplication of two numbers : • Program : • /* Program to calculate multiplication of two numbers. • Creation Date : 10:51 PM 21/11/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int a,b,c; • clrscr(); • printf("n Enter any 2 numbers : "); • scanf("%d %d",&a,&b); • c = a * b; • printf("n Multiplication is : %d",c); • getch(); • }
  • 15. Output : Enter any 2 numbers : 8 12 Multiplication is : 96_
  • 16. Program to calculate modulus of two numbers : • Program : • /* Program to calculate modulus of two numbers. • Creation Date : 11:01 PM 21/11/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int a,b,c; • clrscr(); • printf("n Enter any 2 numbers : "); • scanf("%d %d",&a,&b); • c = a % b; • printf("n Modulus is : %d",c); • getch(); • }
  • 17. Output : Enter any 2 numbers : 11 5 Modulus is : 1_
  • 19. Program to print pyramid in C : Pattern 1 : • Program : • /* Program to print pyramid pattern in C : Pattern 1 • Creation Date : 12:36 AM 22/11/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i,j; • clrscr(); • for(i=0; i<5; i++) • { • for(j=0; j<5; j++) • { • printf(" * "); • } • printf("n"); • } • getch(); • }
  • 20. Output : * * * * * * * * * * * * * * * * * * * * * * * * *_
  • 21. Program to print pyramid in C : Pattern 2 : • Program : • /* Program to print pyramid pattern in C : Pattern 2 • Creation Date : 12:43 AM 22/11/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i,j; • clrscr(); • for(i=0; i<5; i++) • { • for(j=0; j<=i; j++) • { • printf(" * "); • } • printf("n"); • } • getch(); • }
  • 22. Output : * * * * * * * * * * * * * * *_
  • 23. Program to print pyramid in C : Pattern 3 :• /* Program to print pyramid pattern in C : Pattern 3 • Creation Date : 12:28 AM 22/11/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i,j,k; • clrscr(); • for(i=1; i<=5; i++) • { • for(j=5; j>=i; j--) • { • printf(" "); • } • for(k=1; k<=i; k++) • { • printf("*"); • } • printf("n"); • } • getch(); • }
  • 24. Output : * * * * * * * * * * * * * * *_
  • 25. Program to print pyramid in C : Pattern 4 :• /* Program to print pyramid pattern in C : Pattern 4 • Creation Date : 12:54 AM 22/11/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i,j,k,samp=1; • clrscr(); • for(i=5; i>=1; i--) • { • for(k=samp; k>=0; k--) • { • printf(" "); // only 1 space • } • for(j=i; j>=1; j--) • { • printf("*"); • } • samp = samp + 1; • printf("n"); • } • getch(); • }
  • 26. Output : * * * * * * * * * * * * * * *_
  • 27. Program to print pyramid in C : Pattern 5 : • Program : • /* Program to print pyramid pattern in C : Pattern 5 • Creation Date : 01:08 AM 22/11/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i,j; • clrscr(); • for(i=5; i>=1; i--) • { • for(j=1; j<=i; j++) • { • printf(" * "); • } • printf("n"); • } • getch(); • }
  • 28. Output : * * * * * * * * * * * * * * *_
  • 29. Program to print pyramid in C : Pattern 6 : • Program : • /* Program to print pyramid pattern in C : Pattern 6 • Creation Date : 01:52 AM 22/11/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i,j,k,t=0; • clrscr(); • for(i=1; i<=5; i++) • { • for(k=t; k<5; k++) • { • printf(" "); • } • for(j=0; j< i; j++) • { • printf(" * "); • t = t + 1; • } • printf("n"); • } • getch(); • }
  • 30. Output : * * * * * * * * * * * * * * *_
  • 31. Program to print pyramid in C : Pattern 7 :• Program : • /* Program to print pyramid pattern in C : Pattern 7 • Creation Date : 01:13 AM 22/11/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i,j,k,samp=1; • clrscr(); • for(i=1; i<=5; i++) • { • for(k=samp; k<=5; k++) • { • printf(" "); • } • for(j=0; j< i; j++) • { • printf("*"); • } • samp = samp + 1; • printf("n"); • } • samp = 1; • for(i=4; i>=1; i--) • { • for(k=samp; k>=0; k--) • { • printf(" "); • } • for(j=i; j>=1; j--) • { • printf("*"); • } • samp = samp + 1; • printf("n"); • } • getch(); • } •
  • 32. Output : * * * * * * * * * * * * * * * * * * * * * * * * *_
  • 33. Program to print pyramid in C : Pattern 8 : • Program : • /* Program to print pyramid pattern in C : Pattern 8 • Creation Date : 02:39 PM 01/10/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int rw, c, no=1 ,len; • clrscr(); • printf("Enter number of rows: "); • scanf("%d," &len); • for(rw=1; rw<=len; rw++) • { • printf("n"); • for(c=1; c<=rw; c++) • { • printf(" %2d ", no); • no++; • } • } • getch(); • }
  • 34. Output : Enter number of rows: 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15_
  • 35. Program to print pyramid in C : Pattern 9 :• Program : • /* Program to print pyramid pattern in C : Pattern 9 • Creation Date : 03:19 PM 01/10/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int no,i,y,x=35; • clrscr(); • printf("Enter number of rows: "); • scanf("%d," &no); • for(y=0;y<=no;y++) • { • goto(x,y+1); • for(i=0-y; i<=y; i++) • { • printf(" %3d ", abs(i)); • x=x-3; • } • } • getch(); • }
  • 36. Output : Enter number of rows: 5 0 1 0 1 2 1 0 1 2 3 2 1 0 1 2 3 4 3 2 1 0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5_
  • 37. Program to print pyramid in C : Pattern 10 : • Program : • /* Program to print pyramid pattern in C : Pattern 10 • Creation Date : 03:14 PM 01/10/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i, j=5, k, x; • clrscr(); • for(i=1;i<=5;i++) • { • for(k=1;k<=j;k++) • { • printf(" "); • } • for(x=1;x<=i;x++) • { • printf("%d",i); • printf(" "); • } • printf("n"); • j=j-1; • } • getch(); • }
  • 38. Output : 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5_
  • 39. Program to print pyramid in C : Pattern 11 :• Program : • /* Program to print pyramid pattern in C : Pattern 11 • Creation Date : 03:24 PM 01/10/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int rw,c,no,spc; • clrscr(); • printf("Enter number of rows : "); • scanf("%d", &no); • for(rw=1; rw<=no; rw++) • { • for(spc=no; spc>=rw; spc--) • { • printf(" "); • } • for(c=1; c<=rw; c++) • { • printf("%2d",c); • } • printf("n"); • } • getch(); • }
  • 40. Output : 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5_
  • 41. Program to print pyramid in C : Pattern 12 : • Program : • /* Program to print pyramid pattern in C : Pattern 12 • Creation Date : 03:24 PM 01/10/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i,j,k; • clrscr(); • for(i=1; i<=5; i++) • { • for(j=1; j<=5-i; j++) • { • printf(" "); • } • for(k=1; k<=2*i-1; k++) • { • printf(" %d ",k); • } • printf("n"); • } • getch(); • }
  • 42. Output : 1 1 2 3 1 2 3 4 5 1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 9_
  • 43. Program to print pyramid in C : Pattern 13 : • Program : • /* Program to print pyramid pattern in C : Pattern 13 • Creation Date : 04:24 PM 01/10/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • int i,j,asci,spc; • clrscr(); • for(i=7; i>=1; i--) • { • for(spc=6; spc>=i; spc--) • { • printf(" "); • } • asci=65; • for(j=1; j<=i; j++) • { • printf("%2c",asci++); • } • for(j=i-1; j>=0; j--) • { • printf("%2c",--asci); • } • printf("n"); • } • getch(); • }
  • 44. Output : A B C D E F G G F E D C B A A B C D E F F E D C B A A B C D E E D C B A A B C D D C B A A B C C B A A B B A A A_
  • 45. Program to all Combinations of characters A,B,C in C : Pattern 14 : • Program : • /* Program to print all Combinations of characters A, B, C : Pattern 14 • Creation Date : 11:33 PM 01/10/2011 • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • void main() • { • char ch1, ch2, ch3; • clrscr(); • for(ch1='A' ; ch1<='C' ; ++ch1) • { • for(ch2='A' ; ch2<='C' ; ++ch2) • { • for(ch3='A' ; ch3<='C' ; ++ch3) • { • printf(" %c%c%c", ch1, ch2, ch3); • } • } • } • getch(); • }
  • 46. Output : AAA AAB AAC ABA ABB ABC ACA ACB ACC BAA BAB BAC BBA BBB BBC BCA BCB BCC CAA CAB CAC CBA CBB CBC CCA CCB CCC_
  • 47. Addition of two matrices :
  • 48. Program : /* Program to demonstrate addition of two matrices. Creation Date : 25 Nov 2011 11:35:00 PM Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • • void main() • { • int a[3][3],b[3][3],c[3][3],i,j; • clrscr(); • printf("nt Enter First Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&a[i][j]); • } • } • printf("nt Enter Second Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&b[i][j]); • } • } • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • c[i][j]=a[i][j]+b[i][j]; • } • } • printf("nt Matrix Addition is : nn"); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • printf("t %d",c[i][j]); • } • printf("n"); • } • getch(); • }
  • 49. Output : Enter First Matrix : 2 1 2 3 2 1 2 3 3 Enter Second Matrix : 2 1 0 2 3 0 1 1 2 Matrix Addition is : 4 2 2 5 5 1 3 4 5_
  • 50. Subtraction of two matrices : • Program : • • /* Program to demonstrate subtraction of two matrices. • Creation Date : 25 Nov 2011 11:42:08 PM • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • • void main() • { • int a[3][3],b[3][3],c[3][3],i,j; • clrscr(); • printf("nt Enter First Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&a[i][j]); • } • } • printf("nt Enter Second Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&b[i][j]); • } • } • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • c[i][j]=a[i][j]-b[i][j]; • } • } • printf("nt Matrix Subtraction is : nn"); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • printf("t %d",c[i][j]); • } • printf("n"); • } • getch(); • }
  • 51. Output : Enter First Matrix : 2 1 2 3 2 1 2 3 3 Enter Second Matrix : 2 1 0 2 3 0 1 1 2 Matrix Subtraction is : 0 0 2 1 -1 1 1 2 1_
  • 52. Multiplication of two matrices :• Program : • /* Program to demonstrate multiplication of two matrices. Creation Date : 25 Nov 2011 11:50:11 PM Author : R.K.Singh */ #include <stdio.h> • #include <conio.h> • void main() • { • int a[3][3],b[3][3],c[3][3],i,j,k; • clrscr(); • printf("nt Enter First Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&a[i][j]); • } • } • printf("nt Enter Second Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&b[i][j]); • } • } • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • c[i][j]=0; • for(k=0;k<3;k++) • { • c[i][j]=c[i][j]+a[i][k]*b[k][j]; • } • } • } • printf("nt Matrix Multiplication is : nn"); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • printf("t %d",c[i][j]); • } • printf("n"); • } • getch(); • }
  • 53. Output : Enter First Matrix : 1 2 1 3 2 1 1 2 1 Enter Second Matrix : 3 3 3 1 2 1 1 1 1 Matrix Multiplication is : 6 8 6 12 14 12 6 8 6_
  • 54. Transpose of matrix :• Program : • • /* Program to demonstrate transpose of matrix. • Creation Date : 26 Nov 2011 12:03:59 PM • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • • void main() • { • int a[3][3],i,j; • clrscr(); • printf("nt Enter Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&a[i][j]); • } • } • printf("nt Transpose of Matrix is : nn"); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • printf("t%d",a[j][i]); • } • printf("n"); • } • getch(); • }
  • 55. Output : Enter Matrix : 2 1 2 3 2 1 2 3 3 Transpose of Matrix is : 2 3 2 1 2 3 2 1 3_
  • 56. Check matrix is lower triangular or not : • Program : • • /* Program to check lower triangular matrix or not. • Creation Date : 26 Nov 2011 01:14:54 PM • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • • void main() • { • int a[3][3],i,j,flg=0; • clrscr(); • printf("nt Enter 3*3 Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&a[i][j]); • } • } • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • if(a[i]<a[j] && a[i][j]==0) • { • flg=flg+1; • } • } • } • if(flg==3) • printf("nn Lower triangular matrix !"); • else • printf("nn Not lower triangular matrix !"); • getch(); • }
  • 57. Output : Enter 3*3 Matrix : 1 0 0 1 1 0 2 2 3 Lower triangular matrix !_
  • 58. Check matrix is upper triangular or not : • Program : • • /* Program to check upper triangular matrix or not. • Creation Date : 26 Nov 2011 01:14:54 PM • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • • void main() • { • int a[3][3],i,j,flg=0; • clrscr(); • printf("nt Enter 3*3 Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&a[i][j]); • } • } • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • if(a[i]>a[j] && a[i][j]==0) • { • flg=flg+1; • } • } • } • if(flg==3) • printf("nn Upper triangular matrix !"); • else • printf("nn Not Upper triangular matrix !"); • getch(); • }
  • 59. Output : Enter 3*3 Matrix : 1 2 3 0 1 1 0 0 3 Upper triangular matrix !_
  • 60. Check matrix is unit/identity matrix or not : • Program : • • /* Program to check unit/identity matrix or not. • Creation Date : 26 Nov 2011 08:28:08 PM • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • • void main() • { • int a[3][3],i,j,flg=0,flg2=0,flg3=0; • clrscr(); • printf("nt Enter 3*3 Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&a[i][j]); • } • } • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • if(a[i]<a[j] && a[i][j]==0) • { • flg=flg+1; • } • if(a[i]>a[j] && a[i][j]==0) • { • flg2=flg2+1; • } • if(a[i][j]==1) • { • flg3=flg3+1; • } • } • } • if(flg==3 && flg2==3 && flg3==3) • printf("nn Unit/Identity matrix !"); • else • printf("nn Not Unit/Identity matrix !"); • getch(); • }
  • 61. Output : Enter 3*3 Matrix : 1 0 0 0 1 0 0 0 1 Unit/Identity matrix !_
  • 62. Check matrix is zero/null matrix or not : • Program : • • /* Program to check zero/null matrix or not. • Creation Date : 26 Nov 2011 02:09:04 PM • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • • void main() • { • int a[3][3],i,j,flg=0; • clrscr(); • printf("nt Enter 3*3 Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&a[i][j]); • } • } • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • if(a[i][j]==0) • { • flg=flg+1; • } • } • } • if(flg==9) • printf("nn Zero/Null matrix !"); • else • printf("nn Not Zero/Null matrix !"); • getch(); • }
  • 63. Output : Enter 3*3 Matrix : 0 0 0 0 0 0 0 0 0 Zero/Null matrix !_
  • 64. Check matrix is diagonal or not : • Program : • • /* Program to check diagonal matrix or not. • Creation Date : 26 Nov 2011 01:14:54 PM • Author : R.K.Singh */ • #include <stdio.h> • #include <conio.h> • • void main() • { • int a[3][3],i,j,flg=0,flg2=0; • clrscr(); • printf("nt Enter 3*3 Matrix : "); • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • scanf("%d",&a[i][j]); • } • } • for(i=0;i<3;i++) • { • for(j=0;j<3;j++) • { • if(a[i]<a[j] && a[i][j]==0) • { • flg=flg+1; • } • if(a[i]>a[j] && a[i][j]==0) • { • flg2=flg2+1; • } • } • } • if(flg==3 && flg2==3) • printf("nn Diagonal matrix !"); • else • printf("nn Not Diagonal matrix !"); • getch(); • } •
  • 65. Output : Enter 3*3 Matrix : 2 0 0 0 5 0 0 0 1 Diagonal matrix !_