Skip to main content

Posts

Showing posts from January, 2017

Ecosia

ECOSIA - A Green search engine “ Ecosia donates 80% profits to planting trees” Site: www.ecosia.org Lauched on 7 th December 2009 and created by Christian Kroll available in more than 26 language. It is located in Berlin, Germany.It is also called as CO2-neutral company.Ecosia has donated to different tree-planting programs. Until December 2010 Ecosia’s donations went to a program by WWF Germany that protected the Juruena-National park in the Amazonas. In order to make sure the protection was kept up, the program also drew up and financed plans with timber companies and the  local communities. According to B-labs, as of January 2015, "In donating 80 percent of its ad revenue, the search engine has raised over $1.5 million for rainforest protection since its founding in December 2009." According to Ecosia, by 2015, the search engine had almost 2.5 million active users, and searches through it had resulted in more than 2 million trees being planted.Since October 201

Simple C program

i/p  :  getting n terms o/p :  see below example eg: i/p : 1 2 3 4 5 6 7 8 o/p: 1 3 5 7 2 4 6 8 #include<stdio.h> int main(){ int i,a[30],n,odd=0,even; scanf( " %d " ,&n); //slight neat trick to find where even number start even = (n %2 ==0)?n /2:n/ 2+1; for (i=0;i<n;i++){ //loop to seperate the odd index and even index if (i %2 ==0){ scanf( " %d " ,&a[odd++]); } else { scanf( " %d " ,&a[even++]); } } for (i=0;i<n;i++)//neat mission accomplished victory printf ( " %d " ,a[i]); return 0; }

Easy way to do animation in image transition in html and javascript

< html lang = "en" > < head > < title > VCET </ title > < script > function image2 (){ var a = document . getElementById ( "ds" ); ds. src = "2.jpg" ; setTimeout (image3, 3000 ); } function image3 (){ var a = document . getElementById ( "ds" ); ds. src = "3.jpg" ; setTimeout (image4, 3000 ); } function image4 (){ var a = document . getElementById ( "ds" ); ds. src = "4.jpg" ; setTimeout (image5, 3000 ); } function image5 (){ var a = document . getElementById ( "ds" ); ds. src = "5.jpg" ; setTimeout (image1, 3000 ); } function image1 (){ var a =

CSI coding contest program one

Read all salary of employee which is stored in input.txt file and sum it and store the "sum of all salary" in output.txt file input.txt file Vineel Phatak, 520, NOBODY Ajay Joshi, 250, Vineel Phatak Abhishek Chauhan, 120, Ajay Joshi Jayesh Godse, 500, NOBODY Vijaya Mundada, 60, Abhishek Chauhan Shital Tuteja, 45, Jayesh Godse Rajan Gawli, 700, Vineel Phatak Zeba Khan, 300, Jayesh Godse Chaitali Sood, 100, Zeba Khan Sheila Rodrigues, 35, Vineel Phatak output 2630 solution # include < stdio.h > # include < ctype.h > # include < string.h > FILE * fp ; static int sal_sum = 0 ; void sum ( char a [ ] ) { int tmp = atoi ( a ) ;//to convert string to integer => atoi sal_sum + = tmp ; } int main ( ) { char str [ 100 ] ; clrscr ( ) ; fp = fopen ( " input.txt " , " r " ) ; while ( ! feof ( fp ) ) { fscanf ( fp , " %s " , str ) ; if ( isdigit ( str [ 0 ] ) ) {//check if the string

C program for bracket matching

# include < stdio.h > int main ( ) { char a [ 24 ] , stack [ 24 ] ; int n , i , top = 0 , cnt = 0 ; scanf ( " %s " , a ) ; n = strlen ( a ) ; if ( n % 2 = = 0 ) { for ( i = 0 ; i < n ; i + + ) { switch ( a [ i ] ) { case '(' : case '{' : case '[' : case '<' : stack [ top + + ] = a [ i ] ; break ; case ')' : if ( stack [ - - top ] = = '(' ) { cnt + + ; } break ; case '}' : if ( stack [ - - top ] = = '{' ) cnt + + ; break ; case ']' : if ( stack [ - - top ] = = '[' ) cnt + + ; break ; case '>' : if ( stack [ - - top ] = = '<' ) cnt + + ; break ; default : break ; } } //printf("%s %d %d",stack,cnt,n); if ( n / 2 = = cnt ) printf ( " valid " ) ; else printf ( " invalid " ) ; } else printf ( " invalid " ) ; return 200 ; } if u have

Python script for Automatic compile and Run c program

  # inorder to make the program to work you need # xdotool # pyperclip # python ( ofcourse ) # important it is done for linux based system so windows user hit  " powershell " that will give u necessary power import os import time import pyperclip #library for accessing clipboard #creating a time delay for 2 seconds time . sleep (2) #sending the key stroke ctrl+c i.e copy using xdotool os. system ( "xdotool key --delay 13 ctrl+c" ) #some predefined stmt x = "#include<stdio.h> \n int main(){" #combine above stmt with what we copied x+=pyperclip.paste() #last touch to c code x+= "return 0;}" #creating 1 sec delay time . sleep (1) # i prefare storing files in tmp directory f= open ( "/tmp/code.c" , "w" ) #write the data to file and length contains no of bytes  return if u want use it or leave it length = f. write (x) #close the file f. close () ## Here is the actual magic happens open a