Saturday, July 4, 2015

Open Up

people always says to me you need to talk to more number of people or open up to the people. what they don't understand is i am trying to talk to them,they don't listen to me,they don't treat me as one of them. if they try to listen to me they can hear me but they don't try at all.In a group when i try to say something or say something they cant hear it because they don't remember i am there with them.if they don't treat me as one of them why i need to talk to them. From my childhood i am adjusted to this kind of situation, now someone come and says to talk you have to talk. the people who says to me you have to talk they don't listen to me,they don't have any right o say this. people say i do more work, i don't have anyone to talk, i don't have anyone come with me to anyplace what else i can do.
i think this situations make me to work more.
                   people i say one thing, don't say to some one you have to talk more or mingle up with people,when you don't show any interest talk to me or don't include in a group if you don't recognize them

Friday, April 10, 2015

Solve the system of equations: x + y + z = a x2 + y2 + z2 = b2 xy = z2 where a and b are constants. Give the conditions that a and b must satisfy so that x; y; z (the solutions of the system) are distinct positive numbers.

x+y+z=a  ---(1)
x^2+y^2+z^2=b^2 ---(2)
xy=z^2 ---(3)
squaring on both sides on first equation
(x+y+z)^2=a^2
x^2+y^2+z^2+2(xy+yz+zx)=a^2
b^2+2(xy+yz+zx)=a^2
2(xy+yz+zx)=a^2 - b^2
2(z^2+yz+zx)=a^2-b^2
2z(z+x+y)=a^2-b^2
2az=a^2-b^2
z=(a^2-b^2)/2a
x^2+y^2= -(a^2-b^2)^2/4a^2
(x-y)^2=x^2+y^2-2xy
            = -3(a^2-b^2)^2/4a^2
x-y=sqrt( -3(a^2-b^2)^2/4a^2)=sqrt(-3) a^2-b^2/2a  ----(5)
x+y=a-z
x+y=a^2+b^2/2a ---(6)
 by adding 5 and 6 we get x
x=(a^2+b^2)/4a + sqrt(3) * i * (a^2-b^2)/4a  where i is imaginary
by subtractiing 5 from 6
y=(a^2+b^2)/4a - sqrt(3) * i * (a^2-b^2)/4a

the values of x,y,z are
x=(a^2+b^2)/4a + sqrt(3) * i * (a^2-b^2)/4a
y=(a^2+b^2)/4a - sqrt(3) * i * (a^2-b^2)/4a
z=(a^2-b^2)/2a
i got to this solution i hope this helps

Tuesday, February 25, 2014

How to Use the Command Line to Kill a Program

Everyone knows how to kill a program using TASK MANAGER in WINDOWS or Force Quit in
OS X,but sometimes it's useful to kill a program using the command line.

How to Hide Files in JPEG Pictures

If you’re looking to hide files on your PC hard drive, you may have read about ways to encrypt folders or change the attributes on a file so that they cannot be accessed by snoppy eyes. However, a lot of times hiding files or folders in that way requires that you install some sort of software on your computer, which could then be spotted by someone else.

You can actually hide any type of file inside of an image file, including txt, exe, mp3, avi, or whatever else. Not only that, you can actually store many files inside of single JPG file, not just one! This can come in very handy if you need to hide files and don’t want to bother with encryption and all that other technical stuff.

Monday, February 24, 2014

C program to check leap year

C program to check leap year: c code to check leap year, year will be entered by the user.


C programming code

#include <stdio.h>
 
int main()
{
  int year;
 
  printf("Enter a year to check if it is a leap year\n");
  scanf("%d", &year);
 
  if ( year%400 == 0)
    printf("%d is a leap year.\n", year);
  else if ( year%100 == 0)
    printf("%d is not a leap year.\n", year);
  else if ( year%4 == 0 )
    printf("%d is a leap year.\n", year);
  else
    printf("%d is not a leap year.\n", year);  
 
  return 0;
}

Output of program:


Please read the leap year article at Wikipedia, it will help you to understand the program. This code is based on Gregorian Calendar.

C program to check whether input alphabet is a vowel or not

This code checks whether an input alphabet is a vowel or not. Both lower-case and upper-case are checked

C programming code

#include <stdio.h>
 
int main()
{
  char ch;
 
  printf("Enter a character\n");
  scanf("%c", &ch);
 
  if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch =='o' || ch=='O' || ch == 'u' || ch == 'U')
    printf("%c is a vowel.\n", ch);
  else
    printf("%c is not a vowel.\n", ch);
 
  return 0;
}

Output of program:

 

Check vowel using switch statement

#include <stdio.h>
 
int main()
{
  char ch;
 
  printf("Input a character\n");
  scanf("%c", &ch);
 
  switch(ch)
  {
    case 'a':
    case 'A':
    case 'e':
    case 'E':
    case 'i':
    case 'I':
    case 'o':
    case 'O':
    case 'u':
    case 'U':
      printf("%c is a vowel.\n", ch);
      break;
    default:
      printf("%c is not a vowel.\n", ch);
  }              
 
  return 0;
}

Function to check vowel

int check_vowel(char a)
{
    if (a >= 'A' && a <= 'Z')
       a = a + 'a' - 'A';   /* Converting to lower case or use a = a + 32 */
 
    if (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
       return 1;
 
    return 0;
}

This function can also be used to check if a character is a consonant or not, if it's not a vowel then it will be a consonant, but make sure that the character is an alphabet not a special character.

Add digits of number in c

C program to add digits of a number: Here we are using modulus operator(%) to extract individual digits of number and adding them.

C programming code

#include <stdio.h>
 
int main()
{
   int n, sum = 0, remainder;
 
   printf("Enter an integer\n");
   scanf("%d",&n);
 
   while(n != 0)
   {
      remainder = n % 10;
      sum = sum + remainder;
      n = n / 10;
   }
 
   printf("Sum of digits of entered number = %d\n",sum);
 
   return 0;
}

For example if the input is 98, sum(variable) is 0 initially
98%10 = 8 (% is modulus operator which gives us remainder when 98 is divided by 10).
sum = sum + remainder
so sum = 8 now.
98/10 = 9 because in c whenever we divide integer by another integer we get an integer.
9%10 = 9
sum = 8(previous value) + 9
sum = 17
9/10 = 0.
So finally n = 0, loop ends we get the required sum

Output of program:


Add digits using recursion


#include <stdio.h>
 
int add_digits(int);
 
int main() 
{
  int n, result;
 
  scanf("%d", &n);
 
  result = add_digits(n);
 
  printf("%d\n", result);
 
  return 0;
}
 
int add_digits(int n) {
  static int sum = 0;
 
  if (n == 0) {
    return 0;
  }
 
  sum = n%10 + add_digits(n/10);
 
  return sum;
}

Static variable sum is used and is initialized to 0, it' value will persists after function calls i.e. it is initialized only once when a first call to function is made.