Programming Shortcut

Write, Run and execute Your programs with simple and esay way by Programming Shortcut

Monday, February 4, 2019

sum and product of digit program in java

Hello Friends! Welcome to my blog
Today We will Discus about how to calculate sum of digit and product of digit using while loop of a number in java programming language
The sum of digit of a number is added every digit of number
For example
a number is 8554 then sum of digit is 8+5+5+4=22
And product of digit of a number is multiplication of each digit
For Example
a number is 4581 then product of digit is 4*5*8*1=160
See programming Example:


java program find to sum of digits




import java.util.Scanner;
public class sum_of_digit {
public static void main(String[] args) {
int n, d, s = 0;
Scanner in = new Scanner(System.in);
System.out.println("enter the number");
n = in.nextInt();

while (n > 0) {
d = n % 10;
s = s + d;
n = n / 10;
}
System.out.println("The sum of digit 458"+s);
}
}


Output:
enter the number
8554
The sum of digit 22


java program to find product of digits



import java.util.Scanner;
public class product_of_digit {
public static void main(String[] args) {
int n, d, p = 1;
Scanner in = new Scanner(System.in);
System.out.println("enter the number");
n = in.nextInt();

while (n > 0) {
d = n % 10;
p = p * d;
n = n / 10;
}
System.out.println("The product of digit "+ p);
}
}


Output:
enter the number
4581
The product of digit 160

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this java programming code or input & output please comment below
If you have another question about java programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!

More Code »

sum of digits and product of digits program in cpp

Hello Friends! Welcome to my blog
Today We will Discus about how to calculate sum of digit and product of digit using while loop of a number of c++ programming language
The sum of digit of a number is added every digit of number
For example
a number is 5392 then sum of digit is 5+3+9+2=19
And product of digit of a number is multiplication of each digit
For Example
a number is 5392 then product of digit is 5*3*9*2=270
See programming Example:

c++ program find to sum of digits



      #include
      using namespace std;
 int main(){
            int n ,d,sum=0;
            cout             cin>>n;
            while(n>0){
                d=n%10;
                sum=sum+d;
                n=n/10;
           }
      cout return 0;
     }


Output:
enter The number
185755
The sum of digit= 31


C++ program to find product of digits


    #include
    using namespace std;
    int main(){
       int n ,d,pro=1;
       cout        cin>>n;
       while(n>0){
          d=n%10;
          pro=pro*d;
          n=n/10;
        }
        cout return 0;
    }

Output:
enter The number
5846
The product of digit= 960


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!

More Code »

sum of digits and product of digits program in c

Hello Friends! Welcome to my blog
Today We will Discus about how to calculate sum of digit and product of digit using while loop of a number in c programming language
The sum of digit of a number is addition every digit of number
For example
a number is 5392 then sum of digit is 5+3+9+2=19
And product of digit of a number is multiplication of each digit
For Example
a number is 5392 then product of digit is 5*3*9*2=270
See programming Example:

c program find to sum of digits



#include
#include
void main(){
      int n ,d,sum=0;
  clrscr();
      printf("enter The number");
      scanf("%d",&n);
      while(n>0){
          d=n%10;
          sum=sum+d;
          n=n/10;
      }
        printf("The sum of digit= %d",sum);
getch();
    }


Output:
enter The number
185755
The sum of digit= 31



C program to find product of digits


    #include
    #include
    void main(){
      int n ,d,pro=1;
  clrscr();
      printf("enter The number");
      scanf("%d",&n);
        while(n>0){
          d=n%10;
          pro=pro+d;
          n=n/10;
        }
        printf("The product of digit= %d",pro);
getch();
    }


Output:
enter The number
5846
The product of digit= 960

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c programming code or input & output please comment below
If you have another question about c programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!

More Code »

Switch case program in java

Hello Friends, Welcome to my blog
Today i will dicuss you how to make switch case program in java . switch case is mulit way conditional statement that work like if else nested loop, .
What is switch Case?
Switch case is a multi-way conditional statement. It Works like as if else if nested conditional statement.But the Advantage of using Switch case over if else if nested conditional statement Management of switch case is easy

See Switch case example below that how work switch statement:

switch case program in java

import java.util.Scanner;
public class switchdemo {

    public static void main(String args[]) {
        double a, b, r;
        String c;
        Scanner in = new Scanner(System.in);
        System.out.println("Enter two Numbers to Calculate");

        a = in.nextDouble();
        b = in.nextDouble();
        System.out.println("Please Select a oprtater +, -, *, /");
        c = in.next();
        switch (c) {
            case "+":
                r = a + b;
                System.out.println(a + " + " + b + " = " + r);
                break;
            case "-":
                r = a - b;
                System.out.println(a + " - " + b + " = " + r);
                break;
            case "*":
                r = a * b;
                System.out.println(a + " * " + b + " = " + r);
                break;
            case "/":
                r = a / b;
                System.out.println(a + " / " + b + " = " + r);
                break;
            default:
                System.out.println("Enter valid operator\n");
                break;
        }
    }
}


Output: Enter two Numbers to Calculate
        5
        4
        Please Select a oprtater +, -, *, /
        *
        5.0 * 4.0 = 20.0


     
I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this java programming code or input & output please comment below
If you have another question about java programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience about this post,
Thank You!

      
More Code »

Switch case in program cpp example

Hello friends! Welcome to my blog

Today we discuss How to use switch case conditional statement in c++ and how to program switch case in c++ programming examples

What is switch Case?

Switch case is a multi-way conditional statement. It Works like as if else if nested conditional statement.But the Advantage of using Switch case over if else if nested conditional statement Management of switch case is easy
See Switch case example below that how work switch statement:


Switch case in program c++ example


#include
using namespace std;
int main()
{
char op;
long  a,b,r;

cout cin>> a;
 cin>>b;
cout cin>>op>>endl;
switch(op)
{
case '+':
         r=a+b;
         cout break;
case '-':
r=a-b;
        cout break;
case '*':
r=a*b;
        cout break;
case '/':
        r=a/b;
        cout break;
default:
cout }
return 0;
}


Output: Enter two number to calculate:
             10
              4
Please chooese a operator +, -, *, /
              +
10 + 4 =14


   
I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!

      
More Code »

Switch case program in c with example

Hello friends! Welcome to my blog

Today we discuss How to use switch case conditional statement in c and how to program switch case in c programming examples

What is switch Case?

Switch case is a multi-way conditional statement. It Works like as if else if nested conditional statement.But the Advantage of using Switch case over if else if nested conditional statement Management of switch case is easy

See Switch case example below that how work switch statement:

Switch case in c programming example




    #include
    #include
    main()
    {
        char op;
        long  a,b;
        clrscr();
         printf("Enter two number to calculate: \n");
         scanf("%l\t%l",&a,&b);
         printf("Please chooese a operator +, -, *, /");
         scanf("%f",&op);
         switch(op)
         {
            case '+':
                  printf("%l + %l = %l",a,b,a+b);
                 break;
         case '-':
                 printf("%l - %l = %l",a,b,a-b);
                  break;
        case '*':
                printf("%l * %l = %l",a,b,a*b);
                 break;
         case '/':
printf("%l / %l = %l",a,b,a/b);
break;
default:
printf("Enter valid operator\n");
}
getch();
     }


Output: Enter two number to calculate:
             10  4
Please chooese a operator +, -, *, /
              +
10 + 4 =14
     

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c programming code or input & output please comment below
If you have another question about c programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!

      
More Code »

Program to swap two numbers in java

Hello friends! Welcome to my blog
Here we discuss how to swap two numbers in java language and there are two methods to swap two numbers in java

1. swap two numbers without using third variable in java.

2. swap two numbers with using third variable in java.

See Example below

Swap two numbers without temp in java


import java.util.Scanner;
public class swap_without {
    public static void main(String[] args) {
       int a ,b;
        Scanner in = new Scanner(System.in);
        System.out.println("Enter the two number");
        a=in.nextInt();
        b=in.nextInt();
        System.out.println("Number before Swap:\n a="+a+"\n b="+b);
        a=a+b;
        b=a-b;
        a=a-b;
        System.out.println("Number After Swap:\n a="+a+"\n b="+b);
    }
}


Enter the two number
4
6
Number before Swap:
 a=4
 b=6
Number After Swap:
 a=6
 b=4



Swap two numbers in java


import java.util.Scanner;
public class swap {
    public static void main(String[] args) {
        int a ,b;
        Scanner in = new Scanner(System.in);
        System.out.println("Enter the two number");
        a=in.nextInt();
        b=in.nextInt();
        System.out.println("Number Before Swap:\n a="+a+"\n b="+b);
        int temp=a;
        a=b;
        b=temp;
        System.out.println("Number After Swap:\n a="+a+"\n b="+b);
 
    }
}


Enter the two number
4
7
Number Before Swap:
 a=4
 b=7
Number After Swap:
 a=7
 b=4


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this java programming code or input & output please comment below
If you have another question about Java programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcuts

Please share your experience about this post,
Thank You!
More Code »

how to swap two numbers without temp program in c++

Hello friends! Welcome to my website

Today we show you how to swap two numbers without temp or how to swap two numbers without using third variable in c++ and c++ program to swap two numbers. how to swap two number in cpp with using third variable and swap with third variable


How to swap two numbers without using third variable in c++


#include
using namespace std;
int main() {

int a,b;

cout cin>>a;
cin>>b;
cout a=a+b;
b=a-b;
a=a-b;
cout return 0;
}


  Output: Enter two numbers:
     4
   5
  Before swap:
   a=4
   b=5
  After swap:
   a=5
   b=4


C program to swap two numbers


#include
using namespace std;
int main() {

int a,b,temp;

cout cin>>a;
cin>>b;
cout temp=a;
a=b;
b=temp;
cout return 0;
}


  Output: Enter two numbers:
     4
   5
  Before swap:
   a=4
   b=5
  After swap:
   a=5
   b=4



I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!

More Code »

how to swap two numbers without temp in c

Hello friends! Welcome to my website

Today we show you how to swap two numbers without temp or how to swap two numbers without using third variable in c and c program to swap two numbers and how to swap two numbers in c language programming.

How to swap two numbers without using third variable in c


#include
#include
void main(){
int a,b;
clrscr();
printf("Enter two numbers\n");
sacnf("%d",&a);
sacnf("%d",&b);
printf("Before swap:\n a=%d \n b=%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("After swap:\n a=%d \n b=%d",a,b);
getch();
}



  Output: Enter two numbers:
    4
   5
  Before swap:
   a=4
   b=5
  After swap:
   a=5
   b=4



C program to swap two numbers



#include
#include
void main(){
int a,b,temp;
clrscr();
printf("Enter two numbers\n");
sacnf("%d",&a);
sacnf("%d",&b);
printf("Before swap:\n a=%d \n b=%d",a,b);
temp=a;
b=a;
a=temp;
printf("After swap:\n a=%d \n b=%d",a,b);
getch();
}


  Output: Enter two numbers:
    4
   5
  Before swap:
   a=4
   b=5
  After swap:
   a=5
   b=4



I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c programming code or input & output please comment below
If you have another question about c programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!
More Code »

C++ program for Fibonacci series

Hello friends! Welcome to my website

Program to generate Fibonacci series programming in c++. How to use for loop in c++ language for example
In this Fibonacci series, each number is a sum of the previous two numbers. fibonacci series programming c++ , Fibonacci series c++ programming, Fibonacci series c++ code in c++ session

How to print Fibonacci series programming in c++


    #include
    using namespace std;

    int main() {
        long x, y, z;
        int i, n;
        x = 0;
        y = 1;
        cout         cin>>n;
        cout         for (i = 1; i             z = x + y;
            cout             x = y;
            y = z;
        }
        cout return 0;
    }


Output: Enter the number of terms: 10
        1, 1, 2, 3, 5, 8, 13, 21, 34, 55,


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!
More Code »

Fibonacci series programming in java

Hello friends! Welcome to my website

Program to generate Fibonacci series programming in java. How to use for loop in java language with example
In this Fibonacci series, each number is a sum of the previous two numbers. fibonacci series programming java, Fibonacci series java programming, Fibonacci series java code in java session

How to print Fibonacci series programming in java


import java.util.Scanner;
public class fibonacci {
    public static void main(String[] args) {
        Scanner c = new Scanner(System.in);
        long x, y, z;
        int i, n;
        x = 0;
        y = 1;
        System.out.print("Enter the number of terms : ");
        n = c.nextInt();
        System.out.print(y+", ");
        for (i = 1; i             z = x + y;
            System.out.print(z+", ");
            x = y;
            y = z;
        }
        System.out.print(" ");
    }
}


Output: Enter the number of terms: 10
        1, 1, 2, 3, 5, 8, 13, 21, 34, 55,


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this java programming code or input & output please comment below
If you have another question about java programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!
More Code »

fibonacci series programming c

Hello friends! Welcome to my website

Program to generate fibonacci series programming in c. How to use for loop in c language with example
In this fibonacci series each number is a sum of the previous two numbers. fibonacci series programming c, fibonacci series c programming, fibonacci series c code in c  session

How to print fibonacci series programming in c


#include
#include
void main()
{
long x,y,z;
int i,n;
x=0;
y=1;
printf("Enter the number of terms : ");
scanf("%d",&n);
printf("%ld ",y);
for(i=1; i {
z=x+y;
printf("%ld, ",z);
x=y;
y=z;
}
printf("\n");
getch();
}


Output: 
1, 1, 2, 3, 5, 8, 13, 34, 55, 89...................



I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c programming code or input & output please comment below
If you have another question about c programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!

More Code »

Even and odd numbers list betwwen 1 to n in java

Hello friends! Welcome to my website

This session shows how to print all even and odd numbers list between 1 to n by oops concepts in java
This java language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.


Print all even numbers between 1 to n in Java 


import java.util.Scanner;
class test1 {
int n;
public void printeven(int n) {
int i =0;
while ( i if(i%2==0){
System.out.print(i+" ");
}
i++;
}
}
}
public class evenlist {
public static void main(String[] args) {
test1 o = new test1();
Scanner c= new Scanner(System.in);
System.out.print("Enter a Number till want list:");
o.n=c.nextInt();
System.out.println("All Even Number list");
o.printeven(o.n);
}
}


Output:    Enter a Number till want list: 20
All Even Number list
0 2 4 6 8 10 12 14 16 18



Print all odd numbers between 1 to n in Java 


import java.util.Scanner;
class test1 {
int n;
public void printSum(int n) {
int i = 0;
while (i if (i % 2 == 1) {
System.out.print(i + " ");
}
i++;
}
}
}
public class even_and_odd {
public static void main(String[] args) {
test1 o = new test1();
Scanner c = new Scanner(System.in);
System.out.print("Enter a Number till want list: ");
o.n = c.nextInt();
System.out.println("All Odd Number list");
o.printSum(o.n);
}
}


Output:  Enter a Number till want list: 20
All Odd Number list
1 3 5 7 9 11 13 15 17 19

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this java programming code or input & output please comment below
If you have another question about java programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!

More Code »

List of even and odd numbers list 1 to n in c++

Hello friends! Welcome to my website

Today We Run a program to print all even and odd numbers lists in oops concepts in c++.
This session is how to print the even or odd numbers list in c++ Programming. Here we show you, how to use while loop and if loop programming with Example and oops concepts in c++
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.


Print all even numbers between 1 to n in c++

#include
#include
using namespace std;
class test1 {
public:
int n;
void printeven(int n) {
int i =0;
while ( i if(i%2==0){
cout }
i++;
}
}
};
int main() {
test1 o ;
cout cin>>o.n;
cout o.printeven(o.n);
}


Output:    Enter a Number till want list: 20
All Even Number list
0, 2, 4, 6, 8, 10, 12, 14, 16, 18,


Print all odd numbers between 1 to n in c++

#include
#include
using namespace std;
class test1 {
public:
int n;
void printeven(int n) {
int i =0;
while ( i if(i%2==1){
cout }
i++;
}
}
};
int main() {

test1 o ;
cout cin>>o.n;
cout o.printeven(o.n);
}


Output:    Enter a Number till want list: 20
All Odd Number list
1, 3, 5, 7, 9, 11, 13, 15, 17, 19,

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!

More Code »

Print 1 to n even and odd number in c

Hello friends! Welcome to my website

Today We Run a program to print 1 to n even numbers and odd number in c programming. Here I show you, how use of while loop in c programming with Example
This c language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.


Print 1 to n even numbers in c 


#include
#include
void main();{
    int n, i=0;
clrscr();
printf ("Enter a number to want to print odd no. list: ");
scanf("%d",&n);
printf("The Even Numbers list is:\n");
while(i if((i%2)==0){
printf("%d\t", n);
}
i++;
}
  getch();
 }


Output: Enter a number to want to print even no. list: 10
              The Even Numbers list is:
             0 2 4 6 8


Print 1 to n odd numbers  in c 


#include
#include
void main();{
    int n, i=0;
clrscr();
printf ("Enter a number to want to print odd no. list: ");
scanf("%d",&n);
printf("The odd Numbers list is:\n");
while(i if((i%2)==1){
printf("%d\t", n);
}
i++;
}
    getch();
}


Output: Enter a number to want to print odd no. list: 10
              The odd Numbers list is:
              1 3 5 7 9


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c programming code or input & output please comment below
If you have another question about c programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!

More Code »

Find a number is even or odd number in Java

Hello friends! Welcome to my website

Today We Run a program to check a number is an even number or an odd number in java.
This session is how to check the number is even or odd in Java Programming. Here we show you, how use of For loop in java programming with Example and oops concepts in java
This java language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

 Find a number is even or odd number in Java Programming?


import java.util.Scanner;
class test5 {
int n;
public void odd_even(int n) {

if ((n % 2) == 0) {
System.out.println(n + " is an Even Number");
} else {
System.out.println(n + " is a Odd Number");
}
}
}
public class oddandeven {

public static void main(String args[]) {
test5 o = new test5();
Scanner c = new Scanner(System.in);
System.out.print("Enter a Number to check Even or odd: ");
o.n = c.nextInt();
o.odd_even(o.n);
}
}


Output: Enter a Number to check Even or odd: 2
              2 is an Even Number
             Enter a Number to check Even or odd: 3
             3 is an Odd Number

Note: This program is run 2-time output.

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this java programming code or input & output please comment below
If you have another question about java programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!

More Code »

Find even or odd in c++ programming

Hello friends! Welcome to my website

Today We Run a program to check a number is an even number or an odd number in c++.by object-oriented programming in c++
This session is how to check the number is even or odd in c++ Programming. Here we show you, how use of For loop in c++ programming with Example and oops concepts in c++
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

How to Find a number is an even or odd in c++ Programming?


#include
#include
using namespace std;

class test5 {
public:
    int n;
void odd_even(int n) {
if ((n % 2) == 0) {
cout } else {
cout }
}
}
int main() {
test5 o ;
cout cin>>o.n;
o.odd_even(o.n);
    return 0;
}


Output: Enter a Number to check Even or odd: 2
             2 is an Even Number
            Enter a Number to check Even or odd: 3
            3 is an Odd Number

Note: This program is run 2-time output.

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!

More Code »

Check a number is even or odd number in c Programming

Hello friends! Welcome to my website

Today We Run a program to check a number is even number or an odd number in c.
This session is how to check a number is even or odd in c Programming. Here we show you, how use of For loop in c programming with Example
This c language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

How to Find even or odd number in c Programming?


#include
#include
void main();{
    int n;
clrscr();
  printf ("Enter the number to ckeck even or odd number: ");
  scanf("%d",&n);
       if((n%2)==0){
   printf("\n%d is a Even Number", n);
   }
   else{
   printf("\n%d is a Odd Number", n);
   }
 
  getch();
    }


Output: Enter the number to check even or odd number: 4
             4 is an Even number
             Enter the number to check even or odd number: 5
            5 is an Odd number



Note: This program is run 2-time output.


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c programming code or input & output please comment below
If you have another question about c programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!

More Code »

While loop in c++

Hello friends! Welcome to my website

Today We Run a program to print 1 to 10 number in c++ language.
This session is how to print number 1 to 10 and 1 to 10 with the difference of 2 in c++ Programming. Here use of while loop in c++ programming with Example
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

Program to print numbers 1 from 10 in c++ 


#include
#include
using namespace std;
class testnumber {
public:
void printwithone() {
        int i = 1;
        while (i             cout             cout             i++;
        }
    }
};
int mian(){
    testnumber o;
    o.printwithone();
return 0;
    }
}


Output: 1 2 3 4  5 6 7 8 9 10


Program to print numbers 1 from 10 with difference of 2 in c++


#include
#include
using namespace std;
class testnumber {
public:
void printwithone() {
        int i = 1;
        while (i             cout             cout             i=i+2;
        }
    }
};
int mian(){
    testnumber o;
    o.printwithone();
return 0;
    }
}


Output: 1 3 5 7 9


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!
More Code »

how to print 1 to 10 number program in java

Hello friends! Welcome to my website

Today We Run a program to print 1 to 10 number in java language.
This session is how to print number 1 to 10 and 1 to 10 with the difference of 2 in Java Programming. Here use of while loop in java programming with Example
This java language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

Program to print numbers 1 from 10 in java 


class testnumber {

    public void printwithone() {
        int i = 1;
        while (i             System.out.print(i + " ");
            System.out.print(" ");
            i++;
        }
    }
}

public class number {

    public static void main(String args[]) {
        testnumber o = new testnumber();
        o.printwithone();
    }
}


Output: 1 2 3 4  5 6 7 8 9 10


Program to print numbers 1 from 10 with difference of 2 in java


class testnumber {

    public void printwithtwo() {
        int i = 1;
        while (i             System.out.print(i + " ");
            System.out.print(" ");
            i = i + 2;
        }
    }
}

public class number {

    public static void main(String args[]) {
        testnumber o = new testnumber();
        o.printwithtwo();
    }
}


Output: 1 3 5 7 9



I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this java programming code or input & output please comment below
If you have another question about java programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!
More Code »
Newer Posts Older Posts Home

About Programming Shortcut

This is a programming learning website that can help you learn and when your write your programming code. And all programming code is compiled run programming code in the following programming language C, c++, Java, php and Javascript Languages. find your programming read, understand the programming then copy and past and run your program and save your golden time to typing the program becuse you learn more in leas time. All Programming is codeing is ease to understand the programming