answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Is it possible to assign an int to a double?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How you assign int to short if s is short and i is int?

By type casting since int is of larger bits than short s=(int)i;


Size of a variable without using sizeof operator?

Declare 2 pointer variable of the same type and assign the address of the variable to them and then increment one of them. Find the difference between the above 2 pointers using a type cast. This will be the size of the variable. Eg: double i; double * p = &i; double * q= p; p++; cout<<(int)p-(int)q<<endl;


Typedef int a a a Is this possible in C?

No, but 'typedef int a;' is possible, it defines the type 'a'.


What if -1 is assigned to a unsigned variable in C plus plus?

If you assign -1 to a unsigned variable it will contain the biggest number its able to hold. For example if you assign -1 to a unsigned int it will be 4294967295 as its the biggest number a unsigned int can hold.


What is a double in visual basic?

A double essentially is an int but with a decimal. For example, 4.5 is a double. But the int value of that would be 4


What happens if you assign a number with a decimal to an integer?

Some smart compilers will not allow you do that. If you managed to do that, there are couple different results, the most predictible is decimal part will be cut, only what left will be shown. If it exceed the amount of memory reserved for int (double > float > int), it will show the maximum or positive or negative value for int type, or it will shifted by some amount from the maximum or minimum.


How do you assign the value 45 to the variable PassMark using High-level programming language?

In C: int pass_mark; pass_mark = 45; In C++: int pass_mark {45};


C plus plus prog a function mean that returns the mean of all Values in the given array double mean int list int arraySize?

double mean(int list[], int arraySize) { double result=0; for(int i=0; i<arraySize; ++i ) result += list[i]; return(result/size); }


What about nested for loop?

Possible. Example: void mat_mul (int m, int n, int l, const int **a, const int **b, int **c) { int i, j, k; double sum; for (i=0; i<m; ++i) { for (j=0; j<l; ++j) { sum= 0; for (k=0; k<n; ++k) { sum += a[i][k] * b[k][j]; } c[i][j]= sum; } }


How do you write a program that generates three random numbers and prints the largest?

For this you need two variables, a and b. Generate the first number and assign it to a. Generate the second and assign it to b. If b is greater than a, assign b to a. Generate the third number and assign it to b. If b is greater than a, assign b to a. Print a. A better method is to use the following function to determine the largest of any two values: int max (int x, int y) { return x>y ? x : y; } Once you know the largest of any two values you can easily determine the largest of any three values with a nested call: int max_of_three (int a, int b, int c) { return max (max (a, b), c)); } Note that we determine the largest of a and b first and then pass that value to a second call along with c, thus establishing the largest of all three. To determine the largest of n values, store the numbers in an array and pass the array and its length to this function: int max_of_n (int a[], size_t n) { int m = a[0]; // store first value while (--n) if (a[n]>m) m=a[n]; // update m whenever a[n] is greater return m; }


Write a program in c plus plus that will convert an integer pointer into an integer and viceversa?

You cannot physically convert variables of one type to another type, you can only cast them to create a new type (a new variable), providing the new type is covariant with the existing type. int i = 100; // int variable int* p = &i; // pointer to int The indirect value of p is i (100) while the direct value of p is the address of i. And because p is a variable, it has an address of its own. Thus converting the pointer p to an int can be done in one of three ways: int j = *p; // assign indirect value of p to j (thus j==100). int k = (int) p; // cast the address stored in p and assign to k (k==address of i) int l = (int) &p; // cast the address of p and assign to l (l==address of p)


What are the data types privided in C?

int,float char,double ,long int,unsined int lots of others..