Friday, 3 January 2014

Write a program to create an array of ten numbers and find which is the highest, at which position?

Program:

#include<stdio.h>
int main()
 {
    int array[10],i,j,k;
    int pos,ha=0;
    clrscr();
    printf("Enter elements into array:");
   for(k=0;k<10;k++)
     scanf("%d",&array[k]);


   for(i=0;i<10;i++)
   {
      if(ha<array[i])
      {
ha=array[i];
pos=i+1;
      }
  }
printf("\n");
printf("the element is: ");
printf("%d",ha);
printf("\n");
printf("position: ");
printf("%d",pos);
getch();
return 0;
}

Output:

Enter number:
99 65 98 65 33 77 25 69 10 6
Number is: 99
Position is: 1

Write a program to print a Floyd's Triangle

Floyd's Triangle:

Floyd's triangle is a right-angled triangular array of natural numbers, used in computer science education. It is named after Robert Floyd. It is defined by filling the rows of the triangle with consecutive numbers, starting with a 1 in the top left corner:2 34 5 67 8 9 10 and so on....

Program:

import java.util.*;
class FloydsTriangle 
{
public static void main(String[] args)
{
int limit; //this variable is useful for howmany  rows we need?
System.out.println("Enter the limit: ");// asking for limit
Scanner sc=new Scanner(System.in);//taking the input from console
limit=sc.nextInt();//taking the input as integer
int count=1; // for printing purpose
for (int index=1;index<=limit ;index++ ) //this is for number of rows
{
  for (int index1=1;index1<=index ;index1++ ) //in particular row it displays the howmany numbers u want
  {
      System.out.print(count+" "); //printing the number by using the "print" method
  count++;// count increment
  
  }//inner for loop
  System.out.println("");// it is for nextline 
           
            }//outer for loop
}//main
}//class

Output:


C:\Documents and Settings\user1\Desktop\Programs>javac FloydsTriangle.java

C:\Documents and Settings\user1\Desktop\Programs>java FloydsTriangle
Enter the limit:
4
1
2 3
4 5 6
7 8 9 10


Blocking mail from certain senders in gmail

Sometimes you may get unwanted mail that isn't necessarily spam.

While you can't currently block messages from specific addresses or domains, you can set up a filter to send those unwanted messages directly to Trash.
To set up a filter, follow these steps:
  1. Click the down arrow in your search box at the top of the page. A window that allows you to specify your search criteria will appear.
  2. Enter your search criteria. If you want to check that your search worked correctly, click the search button. Clicking the down arrow again will bring the window back with the same search criteria you entered.
  3. Click Create filter with this search at the bottom of the search window.
  4. Choose the action you'd like for these messages by checking the appropriate box. (In this case, we suggest checking "Delete it.")
  5. Click Create Filter.