
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Learn Python C# Online Compiler
Main.cs Output
// Online C# Editor for free // Write, Edit and Run your C# code using C# Online Compiler
//Rivas, Joy B. //BSIT III- //Write a program that converts a given number from decimal to hexadecimal notation. using System;
public class HelloWorld { public static void Main(string[] args) { Console.Write("Decimal number: "); int dec_num = int.Parse(Console.ReadLine()); int j = dec_num; int d = 0; for (int i = j; i > 0; i = i / 16) { int temp = i % 16; if (temp < 10) temp = temp + 48; else temp = temp + 55; d = d * 100 + temp; } Console.Write($"The hexadecimal of {dec_num} is "); for (int k = d; k > 0; k = k / 100) { int result = k % 100; Console.Write("{0}", (char)result); } } }
Run