Tags: convert ascii into character in assembly language, assembly program to convert ascii into character
Note: This program is compiled in EMU software. Click Here to Download
Write a program in assembly language to get ASCII and convert it into Character.
Saturday, 14 June 2014
Labels:
Assembly Language
Write a program in assembly language to multiply matrices of 3x3 [Updated]
Tags: Multiplication is assembly language, multiplication of matrices in assembly language,
Note: This program is compiled in EMU software. Click Here to Download
Note: This program is compiled in EMU software. Click Here to Download
Labels:
Assembly Language
Write a program in c language to multiply matrices of NxN order by recursion
Wednesday, 14 May 2014
#include <stdio.h>
#include <conio.h>
#define MAX 10
int m,n,o,p;
int c[MAX][MAX];
void multiplyMatrix(int a[MAX][MAX],int b[MAX][MAX]){
static int sum,i=0,j=0,k=0;
if(i<m){ //rows of first matrix
if(j<p){ //columns of second matrix
if(k<n){
sum=sum+a[i][k]*b[k][j];
k++;
multiplyMatrix(a,b);
}
c[i][j]=sum;
sum=0;
k=0;
j++;
multiplyMatrix(a,b);
}
j=0;
i++;
multiplyMatrix(a,b);
}
}
int main(){
int a[MAX][MAX],b[MAX][MAX],i,j,k;
printf("Enter the row and column of first matrix: ");
scanf("%d %d",&m,&n);
printf("Enter the row and column of second matrix: ");
scanf("%d %d",&o,&p);
if(n!=o){
printf("Matrix multiplication is not possible");
printf("\nColumn of first matrix must be same as row of second matrix");
}
else{
printf("Enter the First matrix: ");
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
printf("Enter the Second matrix: ");
for(i=0;i<o;i++)
for(j=0;j<p;j++)
scanf("%d",&b[i][j]);
printf("\nThe First matrix is: \n");
for(i=0;i<m;i++){
printf("\n");
for(j=0;j<n;j++){
printf("%d\t",a[i][j]);
}
}
printf("\nThe Second matrix is: \n");
for(i=0;i<o;i++){
printf("\n");
for(j=0;j<p;j++){
printf("%d\t",b[i][j]);
}
}
multiplyMatrix(a,b);
}
printf("\nThe multiplication of two matrix is: \n");
for(i=0;i<m;i++){
printf("\n");
for(j=0;j<p;j++){
printf("%d\t",c[i][j]);
}
}
getch();
}
#include <conio.h>
#define MAX 10
int m,n,o,p;
int c[MAX][MAX];
void multiplyMatrix(int a[MAX][MAX],int b[MAX][MAX]){
static int sum,i=0,j=0,k=0;
if(i<m){ //rows of first matrix
if(j<p){ //columns of second matrix
if(k<n){
sum=sum+a[i][k]*b[k][j];
k++;
multiplyMatrix(a,b);
}
c[i][j]=sum;
sum=0;
k=0;
j++;
multiplyMatrix(a,b);
}
j=0;
i++;
multiplyMatrix(a,b);
}
}
int main(){
int a[MAX][MAX],b[MAX][MAX],i,j,k;
printf("Enter the row and column of first matrix: ");
scanf("%d %d",&m,&n);
printf("Enter the row and column of second matrix: ");
scanf("%d %d",&o,&p);
if(n!=o){
printf("Matrix multiplication is not possible");
printf("\nColumn of first matrix must be same as row of second matrix");
}
else{
printf("Enter the First matrix: ");
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
printf("Enter the Second matrix: ");
for(i=0;i<o;i++)
for(j=0;j<p;j++)
scanf("%d",&b[i][j]);
printf("\nThe First matrix is: \n");
for(i=0;i<m;i++){
printf("\n");
for(j=0;j<n;j++){
printf("%d\t",a[i][j]);
}
}
printf("\nThe Second matrix is: \n");
for(i=0;i<o;i++){
printf("\n");
for(j=0;j<p;j++){
printf("%d\t",b[i][j]);
}
}
multiplyMatrix(a,b);
}
printf("\nThe multiplication of two matrix is: \n");
for(i=0;i<m;i++){
printf("\n");
for(j=0;j<p;j++){
printf("%d\t",c[i][j]);
}
}
getch();
}
Labels:
C Language,
Recursion
Write a program to check given number is prime or not using recursion
#include <stdio.h>
#include <conio.h>
int isPrime(int number, int i)
{
if(i==1)
{
return 1;
}
else
{
if(number%i==0)
return 0;
else
isPrime(number,i-1);
}
}
int main(){
int number, prime;
printf("Enter a positive number: ");
scanf("%d", &number);
prime = isPrime(number, number/2);
if(prime==1)
printf("%d is a prime number.", number);
else
printf("%d is not a prime number.", number);
getch();
}
#include <conio.h>
int isPrime(int number, int i)
{
if(i==1)
{
return 1;
}
else
{
if(number%i==0)
return 0;
else
isPrime(number,i-1);
}
}
int main(){
int number, prime;
printf("Enter a positive number: ");
scanf("%d", &number);
prime = isPrime(number, number/2);
if(prime==1)
printf("%d is a prime number.", number);
else
printf("%d is not a prime number.", number);
getch();
}
Labels:
C Language,
Recursion
Subscribe to:
Posts (Atom)