This is a small blog for programming.I want to share my thinking,creation and learning to all of you.I also want to develop my own skill as well as yours.
Friday, September 26, 2014
Using Multiple Class In Java
Program:
package munim2;
import java.util.Scanner;
public class rab {
public static void main(String[]args){
Scanner mon=new Scanner(System.in);
jab jabobject=new jab ();
System.out.println("Enter your real name: ");
String name=mon.nextLine();
jabobject.dress(name);
}
}
You must have to take another class to the same source file of the same package.
package munim2;
public class jab {
public static void dress(String name){
System.out.println("Hey "+name);
}
}
Follow the screenshots:
package munim2;
import java.util.Scanner;
public class rab {
public static void main(String[]args){
Scanner mon=new Scanner(System.in);
jab jabobject=new jab ();
System.out.println("Enter your real name: ");
String name=mon.nextLine();
jabobject.dress(name);
}
}
You must have to take another class to the same source file of the same package.
package munim2;
public class jab {
public static void dress(String name){
System.out.println("Hey "+name);
}
}
Follow the screenshots:
Screenshots
Set Class
Program
Output
Wednesday, September 24, 2014
Monday, September 22, 2014
Find Average Using While Loop In Java
Program:
import java.util.Scanner;
public class readerr {
public static void main(String[]args){
Scanner mon=new Scanner(System.in);
double total=0;
double one;
double count = 0;
double average;
while(count<10){
one=mon.nextDouble();
total=total+one;
count++;
}
average=total/10;
System.out.println("the average of the numbers is "+total);
}
}
import java.util.Scanner;
public class readerr {
public static void main(String[]args){
Scanner mon=new Scanner(System.in);
double total=0;
double one;
double count = 0;
double average;
while(count<10){
one=mon.nextDouble();
total=total+one;
count++;
}
average=total/10;
System.out.println("the average of the numbers is "+total);
}
}
Screenshots
Program
Output
where is the wrong keyword written.........find out
Find Average by Scanning In Java
Program:
package munim;
import java.util.Scanner;
public class reader {
public static void main(String[]args){
double a,b,c,average;
Scanner mon=new Scanner(System.in);
a=mon.nextDouble();
b=mon.nextDouble();
c=mon.nextDouble();
average=(a+b+c)/3;
System.out.println("the average is "+average);
}
}
package munim;
import java.util.Scanner;
public class reader {
public static void main(String[]args){
double a,b,c,average;
Scanner mon=new Scanner(System.in);
a=mon.nextDouble();
b=mon.nextDouble();
c=mon.nextDouble();
average=(a+b+c)/3;
System.out.println("the average is "+average);
}
}
Screenshots
Progam
Output
else if Statement In Java Programming
Program:
package munim;
import java.util.Scanner;
public class real {
public static void main(String[] args){
Scanner mon=new Scanner(System.in);
double size;
size=mon.nextDouble();
if(size>40)
System.out.println("there are not dress in your size");
else{
if(size<10)
System.out.println("the dress start from 10 size");
else
System.out.println("there is a dress for you");
}
}
}
package munim;
import java.util.Scanner;
public class real {
public static void main(String[] args){
Scanner mon=new Scanner(System.in);
double size;
size=mon.nextDouble();
if(size>40)
System.out.println("there are not dress in your size");
else{
if(size<10)
System.out.println("the dress start from 10 size");
else
System.out.println("there is a dress for you");
}
}
}
Screenshots
program
Output
Thursday, September 4, 2014
Javascript Concept
Javascript:
Javascript is a script which is used in a webpage for dynamic view.It is a scripting language.
At the beginning of the javascript you have to follow these steps.
1.At first you have to download a code editor like notepad++.
2.You must have to know HTML and CSS.
3.Then open notepad++ and write these code.
First code:
<html>
<head>
<title>creativity</title>
</head>
<body>
<script type="text/javascript">
document.write("please touch it");
</script>
</body>
</html>
4.Next you have to save the file anywhere and the file type must be .js and .html extension.And must put the both file in the same folder.
5.Run the HTML file on your browser and get the output below.
Follow the screenshots.
Output on the browser: please touch it.
Javascript is a script which is used in a webpage for dynamic view.It is a scripting language.
At the beginning of the javascript you have to follow these steps.
1.At first you have to download a code editor like notepad++.
2.You must have to know HTML and CSS.
3.Then open notepad++ and write these code.
First code:
<html>
<head>
<title>creativity</title>
</head>
<body>
<script type="text/javascript">
document.write("please touch it");
</script>
</body>
</html>
4.Next you have to save the file anywhere and the file type must be .js and .html extension.And must put the both file in the same folder.
5.Run the HTML file on your browser and get the output below.
Follow the screenshots.
Output on the browser: please touch it.
Screenshots
Two
Three
Four
Output after run the html file on browser
Sunday, August 24, 2014
Saturday, August 23, 2014
Linking PHP to server by XAMPP
Linking PHP:
1.After downloading XAMPP,you have to install it to your C drive.
2.When install it successfully,then you have to find the C:/>xampp>htdocs .
3.All PHP file will be saved on the htdocs folder.
Now follow the screenshots below:
1.After downloading XAMPP,you have to install it to your C drive.
2.When install it successfully,then you have to find the C:/>xampp>htdocs .
3.All PHP file will be saved on the htdocs folder.
Now follow the screenshots below:
Screenshots
Step 1:installing Xampp in c drive
Step 2:Saving file directory
Step 3:Saving my php file
Open the program editor like notepad++.Then create a new file and save it the name as your wish on the directory.The file must be a .php(dot php) file.I have saved it as panaroma.php file.
Follow the screenshots:
Screenshots
So,now after saving the file as panaroma.php,go to the browser and write localhost.
But before that you have to remember the XAMPP server was run and start or not.
on your browser you can see:
Screenshots
Next after writing localhost/panaroma.php or which you saved that file to C:/>xampp>htdocs>your saving file on your browser.
Screenshot
This will appear.Because I have saved that file by writing this program on notepad++ as the name of panaroma.php.
Screenshot
Friday, August 22, 2014
Downloading and Installing XAMPP in PHP
About XAMPP:
Downloading XAMPP:
Go to this link.
And download the XAMPP file for windows or linux or mac,which operating system you r using.
follow the screenshots below:
Screenshots
Installing and run the XAMPP:
Double click and install the downloaded file and it will automatic run.
Follow the screenshots below:
Screenshots
After installing and run the downloaded file,this type of screen will appear.
Then for PHP click the start button of apache and mysql.
Follow the screenshots.
Using simple if-else statement in java programming
Program:
package munim3;
public class fabrics {
public static void main(String args[]){
int student,teacher;
student=50;
teacher=10;
if(teacher<student){
System.out.println("teacher can teach every students");
}
else{
System.out.println("teaacher can not teach the students");
}
}
}
package munim3;
public class fabrics {
public static void main(String args[]){
int student,teacher;
student=50;
teacher=10;
if(teacher<student){
System.out.println("teacher can teach every students");
}
else{
System.out.println("teaacher can not teach the students");
}
}
}
Screenshots
Output
Increment Operators In Java Programming
Program:
package munim2;
import java.util.Scanner;
public class prefatch {
public static void main(String args[]){
Scanner moni=new Scanner(System.in);
int tree;
tree=moni.nextInt();
System.out.print("the number of tree is :");
System.out.println(++tree);
System.out.print("the changing number of tree is :");
System.out.println(--tree);
tree++;
tree++;
System.out.print("another number of tree is :");
System.out.println(tree);
}
}
package munim2;
import java.util.Scanner;
public class prefatch {
public static void main(String args[]){
Scanner moni=new Scanner(System.in);
int tree;
tree=moni.nextInt();
System.out.print("the number of tree is :");
System.out.println(++tree);
System.out.print("the changing number of tree is :");
System.out.println(--tree);
tree++;
tree++;
System.out.print("another number of tree is :");
System.out.println(tree);
}
}
Screenshots
Output
Thursday, August 21, 2014
Monday, August 18, 2014
A Program of Sum, Subtraction, Production and Division.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,add,sub,pro;
float div;
printf("Enter 1st number: ");
scanf("%d",&a);
printf("Enter 2nd number: ");
scanf("%d",&b);
add=a+b;
sub=a-b;
pro=a*b;
div=(float)a/(float)b;
printf("\nSum=%d",add);
printf("\nSubstration=%d",sub);
printf("\nProduction=%d",pro);
printf("\nDivision=%.2f",div);
getch();
return 0;
}
Sunday, August 10, 2014
Multi Function In C Programming Language
#include<stdio.h>
add()
{
int x=10,y=12,res;
printf("enter the value of x\n");
scanf("%d",&x);
printf("enter the value of y\n");
scanf("%d",&y);
res=x+y;
printf("the result is %d",res);
}
substract()
{
int num1,num2,result;
printf("enter the value of num1\n");
scanf("%d",&num1);
printf("enter the value of num2\n");
scanf("%d",&num2);
result=num1-num2;
printf("the result is %d",result);
}
run_it()
{
add();
}
main()
{
char answer[20];
printf("what do you want to do?? (type add or substract)");
scanf("%s",&answer);
if(strcmp(answer, "add")==0)
{
run_it();
}
else if(strcmp(answer, "substract")==0)
{
substract();
}
else
{
printf("i can not work\n");
}
fflush(stdin);
getchar();
}
add()
{
int x=10,y=12,res;
printf("enter the value of x\n");
scanf("%d",&x);
printf("enter the value of y\n");
scanf("%d",&y);
res=x+y;
printf("the result is %d",res);
}
substract()
{
int num1,num2,result;
printf("enter the value of num1\n");
scanf("%d",&num1);
printf("enter the value of num2\n");
scanf("%d",&num2);
result=num1-num2;
printf("the result is %d",result);
}
run_it()
{
add();
}
main()
{
char answer[20];
printf("what do you want to do?? (type add or substract)");
scanf("%s",&answer);
if(strcmp(answer, "add")==0)
{
run_it();
}
else if(strcmp(answer, "substract")==0)
{
substract();
}
else
{
printf("i can not work\n");
}
fflush(stdin);
getchar();
}
Simple C Program Using Function
#include<stdio.h>
add()
{
int x=10,y=12,res;
printf("enter the value of x\n");
scanf("%d",&x);
printf("enter the value of y\n");
scanf("%d",&y);
res=x+y;
printf("the result is: %d",res);
}
main()
{
add();
fflush(stdin);
getchar();
}
add()
{
int x=10,y=12,res;
printf("enter the value of x\n");
scanf("%d",&x);
printf("enter the value of y\n");
scanf("%d",&y);
res=x+y;
printf("the result is: %d",res);
}
main()
{
add();
fflush(stdin);
getchar();
}
Subscribe to:
Posts (Atom)