Friday, 15 March 2019

How to Invert an SVG image using CSS ?

You can invert your svg easily by using following css code
svg {
  -webkit-filter: invert(100%); /* safari 6.0 - 9.0 */
          filter: invert(100%);
}
From IE9 and above you can use SVG in <img src="" /> element.

<img class="svg" src="image.svg> </img>

(here src is the url to your svg image)

by using the below css you can easily invert your svg image ,

.svg {
  -webkit-filter: invert(100%); /* safari 6.0 - 9.0 */
          filter: invert(100%);
}

Thursday, 6 December 2018

Java Program to find Area of Circle


AIM:

Write a simple JAVA program to find area of circle.

ALGORITHM :

Step 1: Start

Step 2: Input the radius.

Step 3: Create the object and pass the radius to it.

Step 4: Call the area method from main and print the result.

Step 5: Stop.

PROGRAM :

import java.io.*;

class Circle{

double r;

Circle(){

r=0;

}

Circle(double a){

r=a;

}

void Area(){

double a;

a=3.14*r*r;

System.out.println("Area of cicle is "+ a);

}

}

}

classAreaCircle{

public static void main(String args[])throws IOException{

BufferedReaderbr=new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter the radius:");

int r=Integer.parseInt(br.readLine());

System.out.println(r);

Circle c1=new Circle(r);

c1.Area();

}

}

OUTPUT :

Enter the radius:

3

Area of cicle is 28.259999999999998


Monday, 26 November 2018

Palindrome Checker Tool by Code 4 U


Palindrome Checker Tool


Check
Text sample

Friday, 27 April 2018

C Program to Perform Selection Sort

Program :-


#include<stdio.h>
int A[100];
int findmin(int n,int start)  //Entering the function to find minimum
{
int minpos,i;  //Assigning values
minpos=start;
i=start+1;
while(i<n)  //comparing starts
{
if(A[i]<A[minpos])
minpos=i;
i++;
}
return minpos;  //Returning minimum position
}
void selsort(int n)  //Entering the function to perform Selection sort
{
int t;  //Assigning values
int minpos;
int pass=0;
while(pass<(n-1))  //Passing starts
{
minpos=findmin(n,pass);  //Finding minimum position of the smallest element
t=A[minpos];  //Swapping starts
A[minpos]=A[pass];
A[pass]=t;
pass++;
}
}
void main()  //Entering main function
{
int i,n;
printf("Enter the array size");  //Reading the array size
scanf("%d",&n);
printf("Enter the array elements");  //Reading the array elements
for(i=0;i<n;++i)
scanf("%d",&A[i]);
selsort(n);  //Call funtion to perform selection sort
printf("The sorted array is ");  //Printing sorted array
for(i=0;i<n;++i)
printf("%d\t ",A[i]);
}

Output :-

Eg 1:-
Enter the array size : 5
Enter the array elements  : 32 45 18 25 56
The sorted array is : 18 25 32 45 56





Program To Perform Bubble Sort Using C Language

Program :-

#include<stdio.h>
int A[100];  //global variable
void bblsrt(int n)  //Entering the function to perform bubble sort
{
int i=0;char ch;
int intrchng=0,pass=0;
while(pass<n-1 && intrchng==0)  //Passing starts
{
i=0;intrchng=1;
while(i<n-(pass+1))
{
if(A[i]>A[i+1])  //Swapping
{
int t=A[i];
A[i]=A[i+1];
A[i+1]=t;
intrchng=0;
}
i++;  //Incrementing i
}
if(intrchng==1)  //Return
return;
pass++;  //Incrementing pass
}
}
void main()  //Entering main function
{
int n,i;
printf("Enter the array size : ");  //Reading array size
scanf("%d",&n);
printf("Enter the array elements :"); //Reading array elements
for(i=0;i<n;++i)
scanf("%d",&A[i]);
bblsrt(n);  //Calling function to perform Bubble sort
printf("The sorted array is :");  //Printing sorted elements
for(i=0;i<n;++i)
printf("%d\t ",A[i]);
}



Output :-

Eg 1:-
Enter the array size : 5
Enter the array elements  : 32 45 18 25 56
The sorted array is : 18 25 32 45 56




Thursday, 26 April 2018

Program to Perform Binary Search Recursively using C Language

Program :-


#include<stdio.h>
int A[100];
int binsrch(int item,int low,int high)  //Entering the function to perform Binary search
{
int mid;  //Assigning values
mid=(low+high)/2;
if(low>high)  //Return -1 if low>high else return 'mid' value
return -1;
else if(A[mid]==item)
return mid;
if(A[mid]>item)  //Recurssion starts
binsrch(item,low,mid-1);
if(A[mid]<item)
binsrch(item,mid+1,high);
}
void main()  //Entering the main function
{
int i,n,item,pos;
printf("Enter the array size ");  //Reading the array size
scanf("%d",&n);
printf("Enter the array elements ");  //Reading the array elements
for(i=0;i<n;++i)
scanf("%d",&A[i]);
printf("enter the item to be searched ");  //Reading the item to be searched
scanf("%d",&item);
pos=binsrch(item,0,n-1);  //Call the function to perform binary search
if(pos==-1)  //Printing if not found else position
printf("Item not found\n");
else
printf("The item %d is found at pos %d\n",item,pos+1);
}


Output :-

Eg 1:-
Enter the array size : 5
Enter the array elements  : 32 45 18 25 56
Enter the item to be searched : 23
Item not found

Eg 2:-
Enter the array size : 5
Enter the array elements  : 32 45 18 25 56
Enter the item to be searched : 18


The item 18 is found at the position 3

Program to Perform Binary Search Using C Language

Program :-


#include<stdio.h>
int A[100];
int binsrch(int item,int n)  //Entering Binary search funtion
{
int low=0; // Assigning values
int high=n-1;
int mid;
mid=(low+high)/2;
while(A[mid]!=item && low<=high)  //Searching starts
{
mid=(low+high)/2;
if(A[mid]==item)
return mid;  //Return 'mid' value if found first
if(A[mid]>item)  //Comparing starts
high=mid-1;
else if(A[mid]<item)
low=mid+1;
}
return mid; //Return new 'mid' value if found laterif(low>=high)  //Return -1 if not found
return -1;
}
void main()//Enter the main function
{
int i,n,item,pos;
printf("Enter the array size "); //Reading the array size
scanf("%d",&n);
printf("Enter the array elements "); //Reading the array elements
for(i=0;i<n;++i)
scanf("%d",&A[i]);
printf("enter the item to be searched "); //Reading the item to be searched
scanf("%d",&item);
pos=binsrch(item,n); //Calling funtion to perform Binary search
if(pos==-1) // Printing 'not found' or 'position'
printf("Item not found\n");
else
printf("The item%d is found at pos %d\n",item,pos+1);
}


Output :-

Eg 1:-
Enter the array size : 5
Enter the array elements  : 32 45 18 25 56
Enter the item to be searched : 23
Item not found

Eg 2:-
Enter the array size : 5
Enter the array elements  : 32 45 18 25 56
Enter the item to be searched : 18


The item 18 is found at the position 3

How to Invert an SVG image using CSS ?

You can invert your svg easily by using following css code svg { -webkit-filter: invert(100%); /* safari 6.0 - 9.0 */ filter...