In: Computer Science
Find as many programming languages as possible which fit the following categories. When you find a language which fits the category, indicate the following information:
For full marks, you must find at least two languages for each category. To make the assignment more interesting, extra points will be awarded to the person who finds the most languages for each category. (That is, extra points are available for each of the categories.)
Categories
1)Languages with a built-in integer data type are: C ,C++ ,JAVA :
C:
C language was released in the year:1972
Code for Built-in integer data type in C language:
#include <stdio.h>
int main()
{
int n=10;
printf("%d",n);
return 0;
}
C++:
C++ language was released in the year:1985
Code for Built-in integer data type in C++ language:
#include <iostream>
using namespace std;
int main()
{
int n=20;
cout<<n;
return 0;
}
Java:
Java language was released in the year:1995
Code for Built-in integer data type in Java language:
public class Main {
public static void main(String args[]) {
int x=10;
System.out.println(x);
}
}
2)Languages with a built-in floating-point data type are: C ,C++ ,Python :
C:
C language was released in the year:1972
Code for Built-in integer data type in C language:
#include <stdio.h>
int main()
{
float n=10.8;
printf("%f",n);
return 0;
}
C++:
C++ language was released in the year:1985
Code for Built-in integer data type in C++ language:
#include <iostream>
using namespace std;
int main()
{
float n=20.5;
cout<<n;
return 0;
}
Python:
Python language was released in the year:1989
Code for Built-in integer data type in Python language:
n=float(10.8)
print(n)
3) Languages with a built-in decimal data type are C#, Python:
C#:
C# language was released in the year:2000
Code for Built-in decimal data type in C# language:
using System;
class HelloWorld {
static void Main() {
decimal d = 389.5m;
Console.WriteLine(d);
}
}
Java:
Java language was released in the year:1995
Code for Built-in decimal data type in Java language:
import java.math.BigDecimal;
public class Main{
public static void main(String[] args) {
BigDecimal b =new BigDecimal("120.094321");
System.out.println(b);
}
}
4)Languages with a built-in complex number data type are: Python,C++
Python:
Python language was released in the year:1989
Code for Built-in complex data type in Python language:
c=2+3j
print(c)
print(type(c))
C++:
C++ language was released in the year:1985
Code for Built-in complex data type in C++ language:
#include <iostream>
#include <complex>
using namespace std;
int main()
{
std::complex<double> mycomplex(17.0, 25.8);
cout << "Real part is: " << real(mycomplex) << endl;
cout << "Imaginary part is: " << imag(mycomplex) << endl;
return 0;
}
5)Languages with a built-in character data type are: C++, Java
C++:
C++ language was released in the year:1985
Code for Built-in character data type in C++ language:
#include <iostream>
using namespace std;
int main()
{
char c='A';
cout<<c;
return 0;
}
Java:
Java language was released in the year:1995
Code for Built-in char data type in Java language:
public class Main {
public static void main(String args[]) {
char c='B';
System.out.println(c);
}
}
6)Languages with a built-in mutable string data type are: C#
C#:
C# language was released in the year:2000
Code for Built-in mutable string type in C# language:
using System;
using System.Text;
using System.Collections;
class HelloWorld {
static void Main() {
StringBuilder s = new StringBuilder("Code");
Console.WriteLine(s);
s=new StringBuilder("coding");
Console.WriteLine(s);
}
}
Thank you! if you have any queries post it below in the comment
section I will try my best to resolve your queries and I will add
it to my answer if required. Please give upvote if you like
it.