T3CH
T3CH
CC#
Created by T3CH on 10/26/2023 in #help
❔ c# post request http body
hi! im trying to make a post request to the spotify api, and i cant figure out how to add a body to the request with the value "grant_type=client_credentials&client_id=your-client-id&client_secret=your-client-secret" my current code is
var request = WebRequest.Create("https://accounts.spotify.com/api/token");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
var request = WebRequest.Create("https://accounts.spotify.com/api/token");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
13 replies
CC#
Created by T3CH on 2/3/2023 in #help
❔ circular primes
so this program is meant to find how many circular primes there are below 1 million (should be 55), but is returning some crazy high number. where am i going wrong?
11 replies
CC#
Created by T3CH on 11/17/2022 in #help
❔ API URL
how do i modify the url "https://blockchain.info/ticker" to only show me the "last" part of "JPY"
30 replies
CC#
Created by T3CH on 11/15/2022 in #help
Modulus division returning 1 less than it should [Answered]
public static int
CPCalculatePennies(double change)
{
double pennies = change % 5 % 1 % 0.25 % 0.1 % 0.05 / 0.01;
return (int)pennies;
}
public static int
CPCalculatePennies(double change)
{
double pennies = change % 5 % 1 % 0.25 % 0.1 % 0.05 / 0.01;
return (int)pennies;
}
when i assign change, its equal to 0.95. it should return 5, but this is returning 4? shouldnt it be returning 5?
19 replies
CC#
Created by T3CH on 11/9/2022 in #help
❔ First School Project
I have to make a console app that uses methods and variables, any ideas? (pls dont send the karan github thing, it didnt help)
16 replies
CC#
Created by T3CH on 9/22/2022 in #help
Exiting if loop inside of a while statement and starting over
in my else if statement, how do i make it start at the beginning of the while loop if number is lower or higher than guess?
while (true)
{
if (guess == number)
{
Console.WriteLine("Correct!");
break;
}
else if (guess<number)
{
Console.WriteLine("Number is higher!");
}
else
{
Console.WriteLine("Number is lower!");
}
}
}
while (true)
{
if (guess == number)
{
Console.WriteLine("Correct!");
break;
}
else if (guess<number)
{
Console.WriteLine("Number is higher!");
}
else
{
Console.WriteLine("Number is lower!");
}
}
}
22 replies