PPS PROGRAMS FINAL-Copy
PPS PROGRAMS FINAL-Copy
PROGRAM: 30
AIM: - A Program For Multiplication Of Matrices
FLOWCHART:-0
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
int n,m,p,q,i,j,k;
58
VIBHU BHASIN,858/22,BTPS102-18
scanf("%d %D",&m,&n);
if(n==p)
scanf("%f",&a[i][j]);
scanf("%f",&b[i][j]);
c[i][j]=0;
c[i][j]+=a[i][k]*b[k][j];
printf("product is \n");
59
VIBHU BHASIN,858/22,BTPS102-18
printf("%f",c[i][j]);
printf("\n");
getch();
OUTPUT:-
60
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM: 31
AIM: - A Program For Transpose Of A Matrix
FLOWCHART:
61
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10];
int i,j,m,n;
clrscr();
printf("enter the rows and coloumns of A:\n");
scanf("%d %d",&m,&n);
printf("enter the elements of matrix:\n");
for(i=0;i<n;i++)
for(j=0;j<m;j++)
scanf("%d",&a[i][j]);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
b[i][j]=a[j][i];
printf("transpose is\n");
for(i=0;i<m;i++){
for(j=0;j<m;j++)
{
printf("%d ",b[i][j]);
}
printf("\n");
}
getch();
}
OUTPUT:-
62
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:- 32
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
int a,b,c,prod;
63
VIBHU BHASIN,858/22,BTPS102-18
scanf("%d%d%d",&a,&b,&c);
prod=mul(a,b,c);
getch();
int p;
p=x*y*z;
return(p);
OUTPUT:-
64
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:- 33
FLOWCHART:
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
clrscr();
65
VIBHU BHASIN,858/22,BTPS102-18
swap(&a,&b);
getch();
int temp;
temp=*x;
*x=*y; f
*y=temp;
OUTPUT:-
66
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-34
PROGRAM:
#include<stdio.h>
#include<conio.h>
//global variable
int a=20;
void main()
67
VIBHU BHASIN,858/22,BTPS102-18
//local variables
int c;
clrscr();
c=sum(a,b);
printf("value of c= %d",c);
getch();
return a+b;
OUTPUT:-
68
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-35
START
Read n
I=1
Fact=1
Is i<=n
Fact=fact*i
Print fact
I=i+1
END
69
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main(){
int n, factorial;
clrscr();
scanf("%d", &n);
factorial=fact(n);
getch();
int fact(int n)
fact=fact*i;
return (fact);
OUTPUT:-
70
VIBHU BHASIN,858/22,BTPS102-18
71
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-36
72
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
int n,j;
clrscr();
scanf("%d", &n);
printf("%d", fib(j));
getch();
int fib(int i)
int next;
if(i==1||i==2)
return(1);
else
next=p+c;
p=c;
c=next;
73
VIBHU BHASIN,858/22,BTPS102-18
return(next);
OUTPUT:-
74
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:- 37
FLOWCHART:-
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
75
VIBHU BHASIN,858/22,BTPS102-18
float p,r,t,interest;
clrscr();
scanf("%f",&p);
scanf("%f",&r);
scanf("%f",&t);
interest=si(p,r,t);
printf("interest = %f",interest);
getch();
float x;
x=(p*r*t)/100;
return x;
OUTPUT:-
76
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-38
FLOWCHART:-
PROGRAM:-
#include<stdio.h>
#include<conio.h>
int sum(int);
77
VIBHU BHASIN,858/22,BTPS102-18
void main(){
int n,temp;
clrscr();
scanf("%d",&n);
temp=sum(n);
printf("value=%d",temp);
getch();
int sum(int n)
int value=0;
if(n==0)
return(value);
else
value= n+(sum(n-1));
return(value);
OUTPUT:-
78
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-39
FLOWCHART:-
PROGRAM:-
#include<stdio.h>
#include<conio.h>
79
VIBHU BHASIN,858/22,BTPS102-18
void main()
int n1,n2;
clrscr();
scanf("%d %d",&n1,&n2);
getch();
if(n2!=0)
else
return n1;
OUTPUT:-
80
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-40
FLOWCHART:-
START
END
81
VIBHU BHASIN,858/22,BTPS102-18
PROGRAM:-
#include<stdio.h>
#include<conio.h>
void main()
int c,*pc;
clrscr();
c=22;
printf("value of c: %d\n",c);
pc=&c;
getch();
OUTPUT:-
82