A Boolean is a variable that can hold the value true or false. In most implementations, true is the all-ones bit pattern while false is the all-zeroes bit pattern. As a signed integer in twos-complement notation these patters represent -1 and 0 respectively. However, numeric values can and often do implicitly convert to a Boolean such that non-zero values are always true while zero is always false. For typical container objects (including strings), an empty container implicitly converts to false while a non-empty container implicitly converts to true.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c,n;
printf("enter the numbers");
scanf("%D",&n);
for(i=0;i<n;i++)
a=b;
a=c;
c=a+b;
printf("the sum is %c",);
getch();
}
Difference between function and method?
Constructor will be automatically invoked when an object is created whereas method has to be called explicitly. Constructor needs to have the same name as that of the class whereas functions need not be the same. * There is no return type given in a constructor signature (header). The value is this object itself so there is no need to indicate a return value. * There is no return statement in the body of the constructor. * The first line of a constructor must either be a call on another constructor in the same class (using this), or a call on the superclass constructor (using super). If the first line is neither of these, the compiler automatically inserts a call to the parameterless super class constructor.
Write a c program using dynamic memory allocation to transpose a matrix?
Type your answervoid main()
{
int **a,**b,**c;
//int c[3][3];
int a_r,a_c,b_r,b_c;
int i,j,k;
clrscr();
again:
printf("\nenter rows and columns for matrix one:");
scanf("d",&a_r,&a_c);
printf("\nenter rows and columns for matrix two:");
scanf("d",&b_r,&b_c);
if(a_c!=b_r )
{
printf("\ncan not multiply");
goto again;
}
/* allocate memory for matrix one */
a=(int **) malloc(sizeof(int *),a_r);
for( i=0;i {
a[i]=(int *) malloc(sizeof(int*)*a_c);
}
/* allocate memory for matrix two */
b=(int **) malloc(sizeof(int)*b_r);
for( i=0;i {
b[i]=(int *) malloc(sizeof(int*)*b_c);
}
/* allocate memory for sum matrix */
c=(int **) malloc(sizeof(int *)*a_r);
for( i=0;i {
c[i]=(int *) malloc(sizeof(int)*b_c);
}
printf("\n enter matrix one %d by %d\n",a_r,a_c);
for(i=0;i {
for(j=0;j {
scanf("%d",&a[i][j]);
}
}
printf("\n enter matrix two %d by %d\n",b_r,b_c);
for(i=0;i {
for(j=0;j {
scanf("%d",&b[i][j]);
}
}
/*initialize product matrix */
for(i=0;i {
for(j=0;j {
c[i][j]=0;
}
}
/* multiply matrix one and matrix two */
for(i=0;i {
for(j=0;j {
for(k=0;k {
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
}
/* display result */
printf("\n Product of matrix one and two is\n");
for(i=0;i {
for(j=0;j {
printf("%d\t",c[i][j]);
}
printf("\n");
}
/*free memory*/
for(i=0;i {
free(a[i]);
}
free(a);
for(i=0;i {
free(b[i]);
}
free(b);
for(i=0;i {
free(c[i]);
}
free(c);
printf("\npress any key");
getch();
}
I would suggest you go to
http://code.freefeast.info/matrix-multiplication-using-pointers-in-c-dynamic-matrix-multiplication-in-c/
It has got a well formatted and commented code for this problemWhat is the definition of long?
long overland treks on which cowboys herded cattle from ranches to rail lines
What is the difference between Algebra 2 and Integrated Algebra?
there is no such thing as
Integrated Algebra 2 but they represent the same concept
What is the standard form of the equation of the line with slope 2 passing through the point 5 -6?
Using the standard form y = mx + c
Where m = slope of '2'
The point ( 5,-6) is displaced against ( x,y)
Hence
y - - 6 = 2(x - 5) Note the 'double' negative.
y + 6 = 2x - 10
y = 2x - 16
What are the two ways of describing set in mathematics with examples?
Roster method and set-builder notation.
Example of Roster Method
Example of Set-builder Notation:
How do you answer Fermi questions?
Fermi questions, aka order of magnitude questions ask you to express something numerically that can only be vaguely guesstimated. An example would be how many golf balls does it take to fill the Atlantic Ocean? or how many quarters would it take to cover the surface of the Earth. Because the answers are simply a wild estimation, they are expressed by a power of ten. Say for example you calculated an answer to be 28374738, this would be the equivalent of 2.83 X 10^7, or in a Fermi question, expressed as an answer of 7. The easiest way to go about solving a Fermi question is by breaking it down to as many conversions that you are fairly certain of as possible.
A number expressing a property, quantity, or relation that remains unchanged under specified conditions.
How does simplifying an expression help you to solve an equation efficiently?
It combines like terms and results in the least amount if variables to solve for
What is the value of a 1934 100.00 bill?
What is the value of $100. 00 bill 1934 series # J01186491 A
What 2 numbers multiplied together equals 532 but added together equals 78?
7.5516 and 70.4484 (approx)
How do you find the surface area of a rectagle?
to find the surface area of the triangle we just need to multiply the length with breath.
area=lengthXbreadth
What is the difference between a commutative axiom and an associative axiom?
Commutative Property: The order of the objects from left to right doesn't matter.
For example : 5+3+2 = 3+2+5 = 2+3+5, etc... Because addition is commutative.
Associative Property: Where we put parentheses doesn't matter.
For example: x(yz) = (xy)z if x, y, and z are numbers.
What is the LCM of 6y3 and 18y4?
Prime factor both numbers or expressions and use the factors the number of times it was used the MOST in either number.
6y^3=2*3*y*y*y
18y^4=2*3*3*y*y*y*y
2*3*3*y*y*y*y=18y^4
What is the Value of 1948 32ws sn1456092?
Impossible to answer without a detailed description and the name of the maker.