This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Sunday, May 5, 2013

Simple addition Program Using Java

import java.lang.*;import java.io.*;class Add{    public static void main(String args[])    {        int x=10,y=7,z;        z=x+y;        System.out.println("The result is:"+z);    ...

Write a java Program to find the area of the Circle formula

import java.lang.*;import java.io.*;class Circlearea{    public static void main(String args[])    {        float pi=3.14159f,area;        int r=5;        area=pi*r*r;        System.out.println("The area of the circle is:"+area);    ...

Write a java Program to find the Quadratic Equation roots

import java.lang.*;import java.io.*;class Quadratic{    public static void main(String args[])    {        double b=12.1,a=2.35,c=12.50,dis,root1,root2;        dis=(b*b)-(4*a*c);        root1=(-b+Math.sqrt(dis)/2*a);        root2=(-b-Math.sqrt(dis)/2*a);        if(root1<=0 && root2<=0)        {       ...

Write a java Program to find the Simple Interest rate

import java.lang.*; import java.io.*; class Simpleinterest {     public static void main(String args[])     {         int p=5000,t=12,r=3;         int interest=((p*t*r)/100);         System.out.println("The Simple interest is:"+interest);     } ...

The Fibonacci sequence is defined by the following rule. The first 2 values in the sequence are 1,1. Every subsequent value is the sum of the 2 values preceding it. Write A Java Program (WAJP) that uses both recursive and non-recursive functions to print the nth value of the Fibonacci sequence.

/* Fibonacci series Program in Java */ /*1.Fibonacci program using Non-Recursive Functions*/ import java.lang.*; import java.io.*; class Fibonacci {     public static void main(String args[])throws IOException     {     int i,sum=0,f=1,res,n;     BufferedReader br=new BufferedReader(new InputStreamReader(System.in));     System.out.println("Hey boss This is Fibonacci series Generator program");     System.out.println("Enter The range");    ...

Write a java program on Bubble Sort

/* Bubble Sort program in java */ import java.lang.*; import java.io.*; class BubbleSort {         public static void main(String args[])throws IOException         {                BufferedReader br=new BufferedReader(new InputStreamReader(System.in));                int n,i,j,temp;               ...

Write a java program to find the area of the Circle

/* Program to find the Area of the Circle using pi*r*r formula */ import java.lang.*; import java.io.*; class Circlearea {     public static void main(String args[])     {         float pi=3.14159f,area;         int r=5;         area=pi*r*r;         System.out.println("The area of the circle is:"+area);     } } Output: E:\javamani>java Circlearea The area of the circle is:78...

The Fibonacci sequence is defined by the following rule. The first 2 values in the sequenc are 1,1. Every subsequent value is the sum of the 2 values preceding it. Write A Java Program (WAJP) that uses both recursive and non-recursive functions to print the n th value of the Fibonacci sequence.

/*1.Fibonacci program using Recursive Functions*/ import java.lang.*; import java.io.*; class FibonacciRecursive {     public static void main(String args[])throws IOException     {     int n;     BufferedReader d=new BufferedReader(new InputStreamReader(System.in));     System.out.println("Enter The range");     n=Integer.parseInt(d.readLine());     System.out.println("The fibonacci series is:");     Fibonaccino(n);//funcion...

Write a Java program that allows the user to draw lines, rectangles and ovals.

/*Write a Java program that allows the user to draw lines, rectangles and ovals.*/import java.applet.*;import java.awt.*;import javax.swing.*;public class LinesRectsOvals extends JApplet{    public void paint(Graphics g)    {        super.paint(g);        g.setColor(Color.red);  ...

Demonstrate the functionality of packages.

/*Write a java program to create and demonstrate packages.*/ package MyPack; public class Balance {       String name;       double bal;       public Balance(String n,double b)       {                   name=n;                   bal=b;      ...

Write a java program to create an abstract class named Shape that contains an empty method named numberOfSides ( ).Provide three classes named Trapezoid, Triangle and Hexagon such that each one of the classes extends the class Shape. Each one of the classes contains only the method numberOfSides ( ) that shows the number of sides in the given geometrical figures.

abstract class Shape{    abstract int numberOfSides();}class Trapezoid extends Shape{    private static int sides=4;    int numberOfSides()    {        return sides;    }    public String toString()    {        return "Trapezoid";    }}class Triangle extends Shape{    private static int sides=3;    int numberOfSides()   ...

Write a Java program that creates three threads. First thread displays “Good Morning” every one second, the second thread displays “Hello” every two seconds and the third thread displays “Welcome” every three seconds.

class A extends Thread {      synchronized public void run()      {     try     {         while(true)         {            sleep(1000);            System.out.println("good morning");         }     }     catch(Exception e)     { }      ...

Program to multiply given value with 2, but without using assignment operators

#include<stdio.h> main() {     int a;     clrscr();     printf("Enter A value:");    scanf("%d",&a);     a=a<<1;     printf("The mul given value:%d",a);     getch(); } output: Enter A value: 2 The mul given value : 4 ...

Program to print days, years, months, weeks, to the given days.

#include<stdio.h>#include<conio.h>main(){    int days,years,months,weeks,temp;    clrscr();    printf("Enter Days:");    scanf("%d",&days);    years=days/360;            /*Years Logic*/    days=days%360;            /*Days Logic*/    temp=days;            /*Assign Days to the temp variable*/   ...

Program to Count the number of vowels and consonants in a given string using Conditional operator

#include<stdio.h>#include<string.h>main(){    char s[25];    int i,v=0,c=0;    printf("Enter string--");        scanf("%s",&s);    for(i=0;s[i]!='\0';i++)    (s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='i'||s[i]=='o'||s[i]=='u')?v++:c++;    printf("the count of v is %d \n the count of c is %d",v,c);    getch();} output Enter string-- thisthe count of v is 1 the count of c is ...

Adding C program using functions

/* An to the Functions*/#include<stdio.h>int add(int,int);main(){    int a, b, c;    clrscr();    printf("Enter A and B values:");    scanf("%d %d",&a,&b);    c=add(a,b);    /*Jump to the function name which has add()*/    printf("The additon is: %d",c);    getch();}int add(x,y)/*x, y values means given a,b values copy to the x,y like x=a(value which is given)*/{    int z;    /*Add...

Program to perform Matrix addition

/* ------------------------------------------------------------* | Program Addition of Two matrix                              | | Author : Mr.K.Manikanta         created @ 29-10-2011        | | in V.R.S and Y.R.N college of Eng & Tech                   ...

The total distance traveled by vehicle in 't' seconds is given by distance = ut+1/2at2 where 'u' and 'a' are the initial velocity(m/sec.) and acceleration (m/sec2). Write C program to find the distance travelled at regular intervals of time given the values of 'u' and 'a'.The program should provide the flexibility to the user to select his own time intervals and repeat the calculations for different values of 'u' and 'a'.

#include<stdio.h>#include<conio.h>main(){    float t, u, a,distance;    /* t- time, u- Initial velocity, a- acceleration */    char key;    clrscr();    do    {    clrscr();    printf("\n Enter the Initial Velocity U (m/sec1): ");    scanf("%f",&u);    printf("\n Enter acceleration A (m/sec2): ");    scanf("%f",&a);    printf("\n Enter Time T (minutes):...

Write a C program, which takes two integer operands and one operator from the user, performs the operation and then prints the result.(Consider the Operator +,-,*,/,% and use switch statement.

#include<stdio.h>#include<conio.h>main(){    int a,b;    char operator;    clrscr();    printf("Enter A,B values:");    scanf("%d %d",&a,&b);    printf("Choose one of the operator\n");    printf(" + for addition \n - for subtraction \n * for multiply \n / for division \n \%   modulus\n");    fflush(stdin);    scanf("%c",&operator);    switch(operator)   ...

Program to find the given number is Fibonacci number or not.

#include<stdio.h>#include<conio.h>int main(){    int n,t,f=1;    clrscr();    printf("Enter Value");    /*Read the n value */    scanf("%d",&n);    /*Logic for factorial */    for(t=n;t>0;t--)    {       f=f*t;    }    printf("The factorial of the %d is %d",n,f);getch();}output Enter Value5The factorial of the 5 is 12...

Program to find the Perfect Square of a Given number using C program

#include<stdio.h>#include<math.h>int main(){    int n,t;    clrscr();    printf("Enter n value :");    scanf("%d",&n);    t=sqrt(n);    printf("%d \n",t);    if(n==t*t)    {        printf("Given number is Perfect Square %d",t);    }    else    printf("Given number is Not perfect");getch();}output Enter n value :497Given number is Perfect...

Program to find the radious of a circle Using C language

#include<stdio.h>#include<conio.h>void main(){ float a,pi,r; clrscr(); printf("enter the radius:"); scanf("%f",&r); pi=3.14159; if(r>=0) {  a=pi*r*r;  printf("the area of the circle of radius %f is %f",r,a); }  else  {   printf("negative values are not permitted:");  }  getch();}  outputenter the radius:5the area of the circle of radius 5.000000 is 78.53974...

Program to Convert the temparature celcius to farenheit value

#include<stdio.h>#include<conio.h>#include<math.h>main(){float c,f,temp;clrscr();printf("Enter Temperature Value in Celsius\t");scanf("%f",&c);temp=c*9/5;temp=temp+32;f=temp;printf("          The foreign heat Value\t%f",temp);getch();} output: Enter Temperature Value in Celsius    1          The foreign heat Value        33.79999...

Find fibonacci series to the given number

#include<stdio.h>int main() {    int k=2,r;    long int i=0l,j=1,f;    printf("Enter the number range:");    scanf("%d",&r);    printf("Fibonacci series is: %ld %ld",i,j);    while(k<r){         f=i+j;         i=j;         j=f;         printf(" %ld",j);         ...

Addition of Two Matrices Using Functions

/*C Program addion of two matrixes using function*/#include<stdio.h>#include<conio.h>void read_mat(int,int[10][10]);void add_mat(int,int[10][10],int[10][10]);main(){    int a[10][10],b[10][10],n;    clrscr();    printf("Enter Matrix size:");    scanf("%d",&n);    printf("Your chooses %d*%d Matrix:\n",n,n);    printf("Enter elements into First Matrix:");    read_mat(n,a);    printf("Enter elements into...

C program to find the sum of individual digits

/*Program to find the sum of individual digits*/#include<stdio.h>#include<conio.h>main(){    int a,r,result;    clrscr();    printf("Enter A value:");    scanf("%d",&a);    r=result=0;    while(a>0)    {        r=a%10;        a=a/10;        result=result+r;    }    printf("Sum of individual digits: %d",result);   ...

Program to find the LARGEST and smallest number in the given array

/*Write a C program to find both the LARGEST and SMALLEST number in alist of integers*/#include<stdio.h>main(){    int a[10],n,i,small,large;    clrscr();    printf("Enter how many integers:");    scanf("%d",&n);    printf("Enter %d integers:",n);    for(i=0;i<n;i++)    scanf("%d",&a[i]);    small=large=a[0];    for(i=0;i<n;i++)    {        if(a[i]<small)   ...

Write a C program that uses functions to perform the Matrix Multiplication to the 2 Given Matrixes

/*Write a C program that uses functions to perform theMatrix Multiplication to the 2 Given Matrixes*/#include<stdio.h>#include<conio.h>void read_mat(int,int,int[10][10]);void print_mat(int,int,int[10][10]);void mul_mat(int,int,int,int[10][10],int[10][10]);main(){    int a[10][10],b[10][10],i,j,m,n,p,q;    clrscr();    printf("Enter 1st Matrix Row size and Column size:");    scanf("%d %d",&m,&n);            read_mat(m,n,a);   ...

Write a C program that uses functions to perform the Calculating transpose of a matrix in-place manner.

/*Write a C program that uses functions to perform theCalclulating transpose of a matrix in-place manner.*/#include<stdio.h>#include<conio.h>void read_mat(int,int,int[10][10]);void print_mat(int,int,int[10][10]);void transpose_mat(int,int,int[10][10]);main(){    int a[10][10],b[10][10],i,j,m,n;    clrscr();    printf("Enter Matrix Row size and Column size:");    scanf("%d %d",&m,&n);            read_mat(m,n,a);   ...

Write a C program to determine if the given String is Palindrome or not

/*Write a C program to determine if the given String is Palindrome or not*/ #include<stdio.h>#include<conio.h>#include<string.h>int is_palindrome(char[]);main(){    char ch[50];    int t;    clrscr();    printf("Enter String:");    scanf("%s",ch);    t=is_palindrome(ch);    if(t==1)    printf("Given is palindrome");    else    printf("Given is not palindrome");   ...

Write a C program that uses functions to perform ii.) To Delete a string in to given main string from a Given position.

/*Write a C program that uses functions to perform    ii.) To Delete a string in to given main string from a Given position.*/ #include<stdio.h>#include<conio.h>#include<string.h>void string_deletion(char[100]);    /*FUNCTION DECLARATION*/main(){    char ms[100];    int i;    clrscr();    printf("Enter Main String:");    scanf("%s",ms);    printf("Main string and its position:\n");    for(i=0;ms[i]!='\0';i++)   ...

WRITE A PROGRAM USING RECURSIVE FUNCTIONS TO GET THE BINARY VALUE FOR THE GIVEN DECIMAL NUMBER

/*WRITE A PROGRAM USING RECURSIVE FUNCTIONS TO GET THE BINARY VALUE FOR THE GIVEN DECIMAL NUMBER*/#include<stdio.h>#include<conio.h>void binary(int x);main(){    int num;    clrscr();    printf("Enter number:");    scanf("%d",&num);    printf("The binary value for the given number:\n");    binary(num);    getch();}void binary(int x){    if(x/2)    binary(x/2);    printf("%d",x%2);} output: Enter...

Checking symmetric of a square matrix using functions in C program.

#include<stdio.h>#include<conio.h>int symmetric(int[10][10],int);void read_mat(int[10][10],int);main(){    int a[10][10],i,j,n,s;    clrscr();    printf("Enter Matrix size:");    scanf("%d",&n);    printf("Enter %d Elements:",n*n);    read_mat(a,n);    s=symmetric(a,n);    if(s==1)    printf("Symmetric");    else    printf("Not Symmetric");    getch();}void...

Write a C program to generate Pasal's Triangle

 /*Write a C program to generate Pasal's Triangle*/ #include<stdio.h>#include<conio.h>long factorial(int);main(){    int i,j,n;    /*clear screen logic*/        for(i=0;i<50;i++)        printf("\n");        gotoxy(1,1);    /*clear screen login end*/    printf("                Pascal Triangle\n");   ...

Page 1 of 1212345Next
Twitter Delicious Facebook Digg Stumbleupon Favorites More