Program To Find Sum and Average of 3 Real Numbers
Program To Find Sum and Average of 3 Real Numbers
# include<stdio.h> main() { float a,b,c,sum,average; clrscr(); printf(Enter 3 Real Numbers :\n); scanf(%f%f%f,&a,&b,&c); sum=a+b+c; average=sum/3; printf( Sum = %f Average = %f,sum,average); getch(); return 0; }
# include<stdio.h> main() { int a,b,c; clrscr(); printf( Enter the 3 Numbers :\n); scanf(%d%d%d,&a,&b,&c);
if(a>b) { if(a>c) { printf( A is the Largest Number ); } else printf( C is the Largest Number ); } else { if(b>c) { printf( A is the Largest Number ); } else printf( C is the Largest Number ); } getch(); return 0; }
PROGRAM TO FIND THE ADDITION OF TWO MATRIX #include<stdio.h> main() { int i,j,k,r,c; int a[10][10], b[10][10], sum[10][10]; clrscr(); printf(Enter the Size of Row & Column of Matrix:\n); scanf( %d %d,&i,&j); printf(Enter the Elements of Matrix 1\n); for(i=0; i<r; i++) { for(j=0; j<c; j++) { scanf(%d,&a[i][j]); } } printf(Enter the Elements of Matrix 2\n); for(i=0; i<r; i++) { for(j=0; j<c; j++) { scanf(%d,&b[i][j]); } } for(i=0; i<r; i++) { for(j=0; j<c; j++) { sum[i][j]=a[i][j]+b[i][j]; } }
printf(Addition of Matrix\n); for(i=0; i<r; i++) { for(j=0; j<c; j++) printf(%d\t,sum[i][j]); printf(\n); } getch(); return 0; }
#include<stdio.h> main() { int i,j,k,r,c; int a[10][10], b[10][10], M[10][10], r, c,k; clrscr(); printf(Enter the Size of Row & Column of Matrix:\n); scanf( %d %d,&r,&c); printf(Enter the Elements of Matrix 1\n); for(i=0; i<r; i++) { for(j=0; j<c; j++) { scanf(%d,&a[i][j]); } } printf(Enter the Elements of Matrix2\n); for(i=0; i<r; i++) { for(j=0; j<c; j++) { scanf(%d,&b[i][j]); } } for(i=0; i<r; i++) { for(j=0; j<c; j++) { M[i][j]=0; for(k=0; k<=R; k++)
M[i][j]=M[i][j]+(a[i][j]*b[j][i]); } } printf(Multiplication of Matrix\n); for(r=0; r<=R; r++) { for(c=0; c<=C; c++) printf( %d\t,M[r][c]); printf(\n); } getch(); return 0; }
#include<stdio.h> #include<conio.h> void main() { int n,s=0,r; clrscr(); printf("Enter the number"); scanf("%d",&n); do { r=n%10; s=s+r; n=n/10; }while(n!=0); printf("the sum is %d",s); getch(); }