#include<iostream>
#include<cmath>
using namespace std;
main()
{
int a,b,c,Min;
cout<<"Enter 3 Numbers\n";
cin>>a>>b>>c;
Min=min(a,b);
Min=min(Min,c);
cout<<"Smallest Number= "<<Min;
}
#include<iostream>
#include<cmath>
using namespace std;
main()
{
int a,b,c,Min;
cout<<"Enter 3 Numbers\n";
cin>>a>>b>>c;
Min=min(a,b);
Min=min(Min,c);
cout<<"Smallest Number= "<<Min;
}
import java.util.*;
class Min
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int a,b,c,min;
System.out.println("Enter 3 Numbers");
a=in.nextInt();
b=in.nextInt();
c=in.nextInt();
min=Math.min(a,b);
min=Math.min(min,c);
System.out.println("Smallest Number= "+min);
}
}
#include<iostream>
#include<cmath>
using namespace std;
main()
{
double a,d;
cout<<"Enter the side of the Square\n";
cin>>a;
d=sqrt(2)*a;
cout<<"Side of the Square= "<<a<<"\n";
cout<<"Diagonal of the Square= "<<d<<"\n";
}
import java.util.*;
class Diagonal
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
double a,d;
System.out.println("Enter the side of the Square");
a=in.nextInt();
d=Math.sqrt(2)*a;
System.out.println("Side of the Square= "+a);
System.out.println("Diagonal of the Square= "+d);
}
}
/* Question: The final velocity of a vehicle can be calculated by using the formula:
V2=u2+2as;
where u= initial velocity, a=acceleration, s=distance covered
Write a Program in C++ to calculate and Display the final velocity by taking initial velocity, acceleration and the distance covered as inputs. */
#include<iostream>
#include<cmath>
using namespace std;
main()
{
int u,a,s;
double v;
cout<<"Enter the initial Velocity, acceleration and distance covered\n";
cin>>u>>a>>s;
v=sqrt((u*u)+(2*a*s));
cout<<"Final Velocity = "<<v;
}
/* Question: The final velocity of a vehicle can be calculated by using the formula:
V2=u2+2as;
where u= initial velocity, a=acceleration, s=distance covered
Write a Program in Java to calculate and Display the final velocity by taking initial velocity, acceleration and the distance covered as inputs. */
import java.util.*;
public class Velocity
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int u,a,s;
double v;
System.out.println("Enter the initial Velocity, acceleration and distance covered");
u=in.nextInt();
a=in.nextInt();
s=in.nextInt();
v=Math.sqrt((u*u)+(2*a*s));
System.out.println("Final Velocity = "+v);
}
}
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
<!DOCTYPE html> declaration defines that this document is an HTML5 document<html> element is the root element of an HTML page<head> element contains meta information about the HTML page<title> element specifies a title for the HTML page (which is shown in the browser's title bar or in the page's tab)<body> element defines the document's body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.<h1> element defines a large heading<p> element defines a paragraphimport java.util.*;
class SUM_AVG
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int N,Num,Sum=0,avg;
System.out.println("Enter the Number of Numbers");
N=in.nextInt();
for(int i=1;i<=N;i++)
{
System.out.println("Enter a Number");
Num=in.nextInt();
Sum=Sum+Num;
}
avg=Sum/N;
System.out.println("Sum= "+Sum+"\n"+"Average= "+avg);
}
}
#include <iostream>
using namespace std;
main()
{
int N,Num,Sum=0,avg;
cout<<"Enter the Number of Numbers\n";
cin>>N;
for(int i=1;i<=N;i++)
{
cout<<"Enter a Number\n";
cin>>Num;
Sum=Sum+Num;
}
avg=Sum/N;
cout<<"Sum= "<<Sum<<"\n"<<"Average= "<<avg;
}
#include <iostream>
using namespace std;
main()
{
int N,d,Sum=0;
cout<<"Enter a Number\n";
cin>>N;
while(N>0)
{
d=N%10;
Sum=Sum+d;
N=N/10;
}
cout<<"Sum= "<<Sum;
}
#include <iostream>
using namespace std;
main()
{
string s; int i;
cout<<"Enter a word or a sentence\n";
cin>>s;
for(i=0;i<s.length();i++)
cout<<s.at(i)<<"\n";
}
* * * * * * * * * * * * * * *
public class Infinite
{
public static void main()
{
for(;;)
System.out.println("Hello World");
}
}
#include <iostream>
#include <cmath>
using namespace std;
main()
{
float a,b,c,s,area;
cout<<"Enter the 3 sides of a Triangle.\n";
cin>>a>>b>>c;
s=(a+b+c)/2;
area= sqrt(s*(s-a)*(s-b)*(s-c));
cout<<"Area= "<<area<<endl;
}
#include <iostream>
using namespace std;
main()
{
float area,cir,r;
cout<<"Enter the radius of the circle.\n";
cin>>r;
area=(22/7)*r*r;
cir=2*(22/7)*r;
cout<<"Area= "<<area<<endl;
cout<<"Circumference= "<<cir<<endl;
}
using System;
public class Test
{
public static void Main()
{
Console.WriteLine("Hello World");
}
}
#include <iostream>
using namespace std;
main()
{
int a,b;
cout<<"Enter 2 Numbers"<<endl;
cin>>a>>b;
cout<<"Before Swapping :\nThe first Number = "<<a<<endl;;
cout<<"The Second Number = "<<b<<endl;
a=a+b;
b=a-b;
a=a-b;
cout<<"After Swapping :"<<endl;
cout<<"The first Number = "<<a<<endl;
cout<<"The second Number = "<<b<<endl;
}
#include <iostream>
using namespace std;
main()
{
int a,b,c;
cout<<"Enter 2 Numbers"<<endl;
cin>>a>>b;
cout<<"Before Swapping :\nThe first Number = "<<a<<endl;;
cout<<"The Second Number = "<<b<<endl;
c=a;
a=b;
b=c;
cout<<"After Swapping :"<<endl;
cout<<"The first Number = "<<a<<endl;
cout<<"The second Number = "<<b<<endl;
}
/* Question :-
A class contains 'b' number of boys and 'g' number of girls. On a rainy day, 'ba' number of boys and 'ga' number of girls are absent. Write a program to input the values of 'b', 'g', 'ba' and 'ga'. Calculate and display the following:
(i) Percentage of girls present in the class.
(ii) Percentage of boys present in the class.
[Percentage must be calculated on the total number of Students]
*/
#include <iostream>
using namespace std;
int main()
{
int b,g,ba,ga;
float per_boys,per_girls;
cout<<"Enter the number of boys and girls in the class\n";
cin>>b>>g;
cout<<"Enter the number of boys and girls in the class who were absent\n";
cin>>ba>>ga;
per_girls=(float)(g-ga)/(g+b)*100;
per_boys=(float)(b-ba)/(g+b)*100;
cout<<"The Percentage of girls Present in the class : "<<per_girls<<"%\n";
cout<<"The Percentage of boys Present in the class : "<<per_boys<<"%\n";
}
/* Question :-
A class contains 'b' number of boys and 'g' number of girls. On a rainy day, 'ba' number of boys and 'ga' number of girls are absent. Write a program to input the values of 'b', 'g', 'ba' and 'ga'. Calculate and display the following:
(i) Percentage of girls present in the class.
(ii) Percentage of boys present in the class.
[Percentage must be calculated on the total number of Students]
*/
import java.io.*;
class Class
{
public static void main(String args[])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(read);
int b,g,ba,ga;
float per_boys,per_girls;
System.out.println("Enter the number of boys and girls in the class");
b=Integer.parseInt(in.readLine());
g=Integer.parseInt(in.readLine());
System.out.println("Enter the number of boys and girls in the class who were absent");
ba=Integer.parseInt(in.readLine());
ga=Integer.parseInt(in.readLine());
per_girls=(float)(g-ga)/(g+b)*100;
per_boys=(float)(b-ba)/(g+b)*100;
System.out.println("The Percentage of girls Present in the class : "+per_girls+"%");
System.out.println("The Percentage of boys Present in the class : "+per_boys+"%");
}
}
#include <iostream>
using namespace std;
main()
{
int rem_days,years,months,days;
cout<<"Enter the Number of Days\n";
cin>>days;
years=days/365;
rem_days=days%365;
months=rem_days/30;
days=rem_days%30;
cout<<"The number of Years: "<<years<<endl;
cout<<"The number of Months: "<<months<<endl;
cout<<"The number of Days: "<<days<<endl;
}
/*
Floyd's Triangle:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
*/
#include<iostream>
using namespace std;
int main()
{
int i,j,p;
for(i=1,p=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
cout<<p<<" ";
p++;
}
cout<<endl;
}
}
/*
Floyd's Triangle:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
*/
public class Main
{
public static void main (String[] args)
{
int i,j,p;
for(i=1,p=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(p+" ");
p++;
}
System.out.println();
}
}
}
#include<iostream>
using namespace std;
int main()
{
double SI,P,R,T;
cout<<"Enter The Principal, Rate and Time\n";
cin>>P>> R>>T;
SI=(P*R*T)/100.0;
cout<<"The Simple Interest= "<<SI;
}
import java.util.*;
class Simple_Interest
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
double SI,P,R,T;
System.out.println("Enter The Principal, Rate and Time");
P=in.nextDouble();
R=in.nextDouble();
T=in.nextDouble();
SI=(P*R*T)/100.0;
System.out.println("The Simple Interest= "+SI);
}
}
import java.util.*;
class Vertical
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
String s;
System.out.println("Enter a String");
s=in.nextLine();
for(int i=0;i<s.length();i++)
System.out.println(s.charAt(i));
}
}
//Java Program to count the total number of characters in a string import java.util.*; public class CountChars { public static void mai...