USING C#
1. Write a program that takes outputs a string, an integer and a floating-point number separated by commas. Sample output: Bob Marley, 20, 5.2 2.
2. Write a program that asks the user for a string of letters of any size (no spaces), and finally a special character (values 33 to 47 in the Ascii table, or ‘!’ to ‘/’). Generate a random number of any size, integer or floating point, and combine those three pieces of information (in any order) to create a password and display that out to the user. Sample input 1: ILikePatterns + Sample output 1: 525235325ILikePatterns+ Sample input 2: ILikeDecimalNumbers / Sample output 2: ILikeDecimalNumbers/52325.25
1.
using System;
class MainClass {
public static void Main (string[] args) {
//Console.WriteLine ("Hello World");
String str;
int number;
float floatNumber;
Console.WriteLine("Enter a strting: ");
str=Console.ReadLine();
Console.WriteLine("Enter a number: ");
number=(int)Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter a float number: ");
floatNumber=(float)Convert.ToDouble(Console.ReadLine());
Console.WriteLine(""+str+","+number+","+floatNumber);
}
}
==============
//Output
Enter a strting:
Bob Marley
Enter a number:
20
Enter a float number:
5.2
Bob Marley,20,5.2
=========================
2.
using System;
class MainClass {
public static void Main (string[] args) {
Console.WriteLine (" Enter a string of letters of any size (no spaces), and finally a special character (values 33 to 47 in the Ascii table, or ‘!’ to ‘/’): ");
string str="";
char c;
while(true)
{
c=(char) Console.Read();
if(c == 32) //if space don't take it
continue;
if(c>=33 && c<=47)
{
str+=c;
break;
}
str+=c;
}
Console.WriteLine ("\nString enetered is: "+str);
}
}
==========================
Enter a string of letters of any size (no spaces), and finally a
special character (values 33 to 47 in the Ascii table, or ‘!’ to
‘/’):
Hello WORLD!
String enetered is: HelloWORLD!
========================================
3.
using System;
public class Program {
public static void Main() {
Random rand = new Random();
int size= rand.Next(1,10);
Console.WriteLine("Enter a string: ");
string str=Console.ReadLine();
string str1="";
//generate integer number
for(int i = 0; i < size; i++)
str1+=rand.Next(0,10)+48;
string result=str+str1+"+";
Console.WriteLine(""+result);
}
}
=========================
//Output
Enter a string:
ILikeDecimalNumbers
ILikeDecimalNumbers48575149+
USING C# 1. Write a program that takes outputs a string, an integer and a floating-point number s...
#In Coral CHALLENGE ACTIVITY 7.1.1: Convert to binary. Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than e Output x % 2 (remainder is either e or 1) x= x / 2 Note: The above algorithm outputs the O's and 1's in reverse order. Ex: If the input is 6, the output is: 011 (6 in binary is 110; the...
4.18 LAB: Checker for integer string Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9. Exx If the input is: 1995 the output is: yes Ex If the input is: 42,000 1995! the output is no Hint: Use a loop and the Character isDigitO function. 418.1: LAB: Checker for integer string
Task 4: Integer and Floating Point Division Open Division.java and write code to solve the following problem: 1. prompts for and reads in an integer (on the same line) 2. Outputs: i) the value of the number divided by 100 as a floating point value ii) the remainder when the number is divided by 100 iii) the number of times 100 divides the integer iv) outputs the digits of the integer in reverse order; i.e., each digit must be extracted...
Write a program that takes in a line of text as input, and outputs that line of text in reverse. You may assume that each line of text will not exceed 50 characters. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH уен Hint: Use the fgets function to read a string with spaces from the user...
Write a program that prompts the user to enter a character, an integer, and floating point number. After reading the input, the program should print out the values entered. Be sure to format the code correctly and include relevant comments. in c
Write a program that takes an operation (+, -, /, or *) and two floating-point numbers, and outputs the result of applying that operation to the two numbers. For example, if the input is: + 100 3.14 the output should be 100 + 3.14 = 103.14 Likewise, if the input is * 4 5 the output should be 4 * 5 = 20 You may assume the input is well-formed; that is, the first string is one of the four...
Python question: Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x modulo 2 (remainder is either 0 or 1) Assign x with x divided by 2
Write the Code in C program. Create a random password generator that contains a user-specified number of characters. Your program should prompt the user for the desired length of the password. Length of password: To create your password, use the random number generator in the stdlib.h C library. To generate random numbers, you will need the srand() and rand() functions. srand(seed) is used to "seed" the random number generator with the given integer, seed. Prompt the user for the seed...
C++ Suppose a user is prompted to enter four floating point number values. Write a C++ program that outputs the number of input values, the number of negative values, and the number of even values.
Problem 16. Write a program to prompt the user for a floating point number x and compute the following formula: Problem 18. Write a program fragment that uses nested for loops to produce the following output, making sure that the user input is between 3 and 42.