Uploaded by Camila Cruz Vargas

4:1:1 programacion

advertisement
Identify the following C# declarations and initializations of variables as legal or not legal.
If they are not legal, indicate how to correct them.
Content:
1. double num = 2; LEGAL aunque se supone que el double es para numeros muy pequeño
o muy grandes y decimales, pero en este caso tecnicamente es válido.
2. String ohSnap = "%$^&$ "; NOT LEGAL correction: string ohSnap = "%$^&$ ";
3. int num2 = 10.9; NOT LEGAL correction: float num2 = 10.9;
4. byte smallNum = -42; NOT LEGAL correction: bytes can’t be negative
5. char word = 'word'; NOT LEGAL correction: ‘w’;
6. long bigNum = 12345678.9; NOT LEGAL correction: long bigNum = 123456789;
7. float x = 3.5F; = NOT LEGAL correction: float x = 3.5;
8. decimal deciNum = 4.2m; NOT LEGAL correction: decimal deciNum = 4.2;
Download