can any one make two different function that can be call in main for code which is writed in bold
#include<conio.h>
#include<stdio.h>
void main()
{
int c[100][100], a[100][100], b[100][100];
int m,n,o,p,i,j,k,r,t;
printf("\n Enter the no. of rows and columns of matrix: \n");
scanf(" %d %d",&m,&n);
printf("\nEnter the matrix elements: \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
printf("Enter the no of rows and columns of Another matrix : ");
scanf("%d%d",&o,&p);
printf("Enter the second matrix elements : \n");
for(i=0;i<o;i++)
{
for(j=0;j<p;j++)
scanf("%d",&b[i][j]);
}
printf("\nThe matrix you entered is : \n");
for(i=0;i<o;i++)
{
for(j=0;j<p;j++)
printf(" %d \t",b[i][j]);
printf("\n");
}
printf("\n\t ADDITION of MATRIX you entered\n"); if(m>o)
{
r=m;
for(i=o;i<m;i++)
{
for(j=0;j<p;j++)
{
b[i][j]=0;
}
}
}
else if(m<=o)
{
r=o;
for(i=m;i<o;i++)
{
for(j=0;j<n;j++)
a[i][j]=0;
}
}
if(n>p)
{
t=n;
for(i=0;i<o;i++)
{
for(j=p;j<n;j++)
b[i][j]=0;
}
}
else if(n<=p)
{
t=p;
for(i=0;i<m;i++)
{
for(j=n;j<p;j++)
a[i][j]=0;
}
}
for(i=0;i<r;i++)
{
for(j=0;j<t;j++)
c[i][j]=0;
}
for(i=0;i<r;i++)
{
for(j=0;j<t;j++)
c[i][j]=a[i][j]+b[i][j];
} for(i=0;i<r;i++)
{
for(j=0;j<t;j++)
printf(" %d \t",c[i][j]);
printf("\n");
}getch();
}
2 1749
yaar koi to help karo plz
can any one make two different function that can be call in main for code which is writed in bold
#include<conio.h>
#include<stdio.h>
void main()
{
int c[100][100], a[100][100], b[100][100];
int m,n,o,p,i,j,k,r,t;
printf("\n Enter the no. of rows and columns of matrix: \n");
scanf(" %d %d",&m,&n);
printf("\nEnter the matrix elements: \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
printf("Enter the no of rows and columns of Another matrix : ");
scanf("%d%d",&o,&p);
printf("Enter the second matrix elements : \n");
for(i=0;i<o;i++)
{
for(j=0;j<p;j++)
scanf("%d",&b[i][j]);
}
printf("\nThe matrix you entered is : \n");
for(i=0;i<o;i++)
{
for(j=0;j<p;j++)
printf(" %d \t",b[i][j]);
printf("\n");
}
printf("\n\t ADDITION of MATRIX you entered\n"); if(m>o)
{
r=m;
for(i=o;i<m;i++)
{
for(j=0;j<p;j++)
{
b[i][j]=0;
}
}
}
else if(m<=o)
{
r=o;
for(i=m;i<o;i++)
{
for(j=0;j<n;j++)
a[i][j]=0;
}
}
if(n>p)
{
t=n;
for(i=0;i<o;i++)
{
for(j=p;j<n;j++)
b[i][j]=0;
}
}
else if(n<=p)
{
t=p;
for(i=0;i<m;i++)
{
for(j=n;j<p;j++)
a[i][j]=0;
}
}
for(i=0;i<r;i++)
{
for(j=0;j<t;j++)
c[i][j]=0;
}
for(i=0;i<r;i++)
{
for(j=0;j<t;j++)
c[i][j]=a[i][j]+b[i][j];
} for(i=0;i<r;i++)
{
for(j=0;j<t;j++)
printf(" %d \t",c[i][j]);
printf("\n");
}getch();
}
What is that you are trying to tell??Please be clear about what to want to change in your code...
Thankx
Sign in to post your reply or Sign up for a free account.
Similar topics
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {...
|
by: phil_gg04 |
last post by:
Dear Javascript Experts,
Opera seems to have different ideas about the visibility of Javascript
functions than other browsers. For example, if I have this code:
if (1==2) {
function...
|
by: laredotornado |
last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to
have my Javascript function execute from the BODY's "onload" method,
but if there is already an onload method defined, I would...
|
by: sushil |
last post by:
+1 #include<stdio.h>
+2 #include <stdlib.h>
+3 typedef struct
+4 {
+5 unsigned int PID;
+6 unsigned int CID;
+7 } T_ID;
+8
+9 typedef unsigned int (*T_HANDLER)(void);
+10
|
by: Olov Johansson |
last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7
and Konqueror 3.5) has support not only for standard function
definitions, function expressions (lambdas) and Function...
|
by: Beta What |
last post by:
Hello,
I have a question about casting a function pointer. Say I want to make
a generic module (say some ADT implementation) that requires a function
pointer from the 'actual/other modules'...
|
by: f rom |
last post by:
----- Forwarded Message ----
From: Josiah Carlson <jcarlson@uci.edu>
To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org
Sent: Monday, December 4, 2006 10:03:28 PM
Subject: Re: ...
|
by: Larax |
last post by:
Best explanation of my question will be an example, look below at this
simple function:
function SetEventHandler(element)
{
// some operations on element
element.onclick =
function(event)
{
|
by: alex |
last post by:
I am so confused with these three concept,who can explained it?thanks
so much?
e.g.
var f= new Function("x", "y", "return x * y");
function f(x,y){
return x*y
}
var f=function(x,y){
|
by: VK |
last post by:
I was getting this effect N times but each time I was in rush to just
make it work, and later I coudn't recall anymore what was the original
state I was working around. This time I nailed the...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |