string changeCase(string s, int n)
{
int n = s.size();
string ans = "";
if (n == 1)
{
for (int i = 0; i < n; i++)
{
int a = 0;
if (s[i] == ' ')
a = 1;
else if (a == 1)
ans += toupper(s[i]);
else
ans += s[i];
}
}
else if (n == 2)
{
for (int i = 0; i < n; i++)
{
int a = 0;
if (s[i] == ' ')
ans += '-';
else
ans += s[i];
}
}
else if (n == 3)
{
for (int i = 0; i < n; i++)
{
int a = 0;
if (s[i] == ' ')
ans += '_';
else
ans += s[i];
}
}
else if (n == 4)
{
ans += toupper(s[0]);
for (int i = 1; i < n; i++)
{
int a = 0;
if (s[i] == ' ')
a = 1;
else if (a == 1)
ans += toupper(s[i]);
else
ans += s[i];
}
}
return ans;
}
C++
Telegram:- @allcoding1
{
int n = s.size();
string ans = "";
if (n == 1)
{
for (int i = 0; i < n; i++)
{
int a = 0;
if (s[i] == ' ')
a = 1;
else if (a == 1)
ans += toupper(s[i]);
else
ans += s[i];
}
}
else if (n == 2)
{
for (int i = 0; i < n; i++)
{
int a = 0;
if (s[i] == ' ')
ans += '-';
else
ans += s[i];
}
}
else if (n == 3)
{
for (int i = 0; i < n; i++)
{
int a = 0;
if (s[i] == ' ')
ans += '_';
else
ans += s[i];
}
}
else if (n == 4)
{
ans += toupper(s[0]);
for (int i = 1; i < n; i++)
{
int a = 0;
if (s[i] == ' ')
a = 1;
else if (a == 1)
ans += toupper(s[i]);
else
ans += s[i];
}
}
return ans;
}
C++
Telegram:- @allcoding1
👍5
🎯HCL Technologies Off Campus Freshers Recruitment Hiring For Analyst Role | 4.2 LPA
Job Role Senior analyst
Education B.Tech
Experience 0-2.5 Years
CTC/Salary 4.2 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
Job Role Senior analyst
Education B.Tech
Experience 0-2.5 Years
CTC/Salary 4.2 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
👍5
import java.lang.Math;
class Gfg {
// driver code
public static void main(String args[])
{
// float numbers
float x = 4567.9874f;
// find the closest int for these floats
System.out.println(Math.round(x));
float y = -3421.134f;
// find the closest int for these floats
System.out.println(Math.round(y));
double positiveInfinity = Double.POSITIVE_INFINITY;
// returns the Integer.MAX_VALUE value when
System.out.println(Math.round(positiveInfinity));
}
}
Java
IBM EXAM ANS 6PM
Telegram:- @allcoding1
class Gfg {
// driver code
public static void main(String args[])
{
// float numbers
float x = 4567.9874f;
// find the closest int for these floats
System.out.println(Math.round(x));
float y = -3421.134f;
// find the closest int for these floats
System.out.println(Math.round(y));
double positiveInfinity = Double.POSITIVE_INFINITY;
// returns the Integer.MAX_VALUE value when
System.out.println(Math.round(positiveInfinity));
}
}
Java
IBM EXAM ANS 6PM
Telegram:- @allcoding1
👍4
x = float(input())
n = int(input())
If n<1 and n>2:
print("Invalid Input")
else:
print(round(x,n))
#Python abridged ans
Telegram:- @allcoding1
n = int(input())
If n<1 and n>2:
print("Invalid Input")
else:
print(round(x,n))
#Python abridged ans
Telegram:- @allcoding1
👍6👎1
🎯HCL Technologies Off Campus Freshers Recruitment Hiring For Analyst Role | 4.2 LPA
Job Role Senior analyst
Education B.Tech
Experience 0-2.5 Years
CTC/Salary 4.2 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
Job Role Senior analyst
Education B.Tech
Experience 0-2.5 Years
CTC/Salary 4.2 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
👍1
👍2
🎯HCL Technologies Off Campus Freshers Recruitment Hiring For Analyst Role | 4.2 LPA
Job Role Senior analyst
Education B.Tech
Experience 0-2.5 Years
CTC/Salary 4.2 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
Job Role Senior analyst
Education B.Tech
Experience 0-2.5 Years
CTC/Salary 4.2 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1