C Programming

C Programming


Character Rectangle Structure

Posted: 26 Dec 2013 11:42 PM PST

Q. Write  a C program to display the following character rectangle structure/pattern/design as:

ABCDEEDCBA
ABCD__DCBA
ABC____CBA
AB______BA
A________A

Ans.

/*c program for character rectangle pattern*/
#include<stdio.h>
int main()
{
 char ch,r='A',c,sp;
 printf("Enter any character : ");
 scanf("%c",&ch);
 if(ch>='a' && ch<='z')
    ch=ch-32;
 printf("\n");
 for(; ch>='A'; ch--,r++)
 {
  for(c='A'; c<=ch; c++)
     printf("%c",c);
  for(sp=r; sp>'A'; sp--)
     printf("__");
  for(c=ch; c>='A'; c--)
     printf("%c",c);
  printf("\n");
 }
 getch();
 return 0;
}

/*************************************************************
The output of above program would be:
*************************************************************/


Output of character rectangle pattern C program
Figure: Screen shot for character rectangle structure C program




Post a Comment

C Programming

C Programming


Number Rectangle Pattern

Posted: 10 Dec 2013 06:28 AM PST

Q. Write a C program to print the following number pattern rectangle as:

1 2 3 4 5 4 5
2 3 4 5 3 4 5
3 4 5 2 3 4 5
4 5 1 2 3 4 5

Ans.

/*c program for number pattern rectangle design*/
#include<stdio.h>
int main()
{

 int n=4,num=5,p=4,r,c,z;
 for(r=1; r<=n; r++,p--)
 {
   for(c=r; c<=num; c++)
      printf(" %d",c);
   for(c=1,z=p; c<=r+1; c++,z++)
     printf(" %d",z);
   printf("\n");
 }
 getch();
 return 0;
}

/***********************************************************
The output of above program would be:
************************************************************/


Output of Number Rectangle Pattern C program
Figure: Screen-shot for Number Rectangle Pattern C program



Post a Comment

IPL Twenty20 Cricket

IPL Twenty20 Cricket


Only T20: Pakistan vs Afghanistan in UAE 2013

Posted: 07 Dec 2013 09:20 AM PST


DateMatch DetailsTime
(IST)
Place
Dec 08 - SunAfghanistan v Pakistan, Only T20I21:30Sharjah

West Indies tour of New Zealand 2013-14

Posted: 07 Dec 2013 09:05 AM PST

DateMatch DetailsTime
(IST)
Place
Jan 11 - Sat1st T20I - New Zealand v West Indies11:30Auckland
Jan 15 - Wed2nd T20I - New Zealand v West Indies11:30Wellington


Post a Comment

9lessons:Htaccess File Tutorial and Tips.

9lessons:Htaccess File Tutorial and Tips.

Link to 9lessons Programming Blog

Htaccess File Tutorial and Tips.

Posted: 19 Nov 2013 11:04 AM PST

After posting Understanding of Regular Expression article most of my readers are expecting .htaccess basics, and I did not find any useful article on Google first page results. Specially I love to write .htaccess file, using this you can easily configure and redirect Apache Web Server file system. This post will explain you how to create friendly URLs, sub domain directory re-directions and many more.

Understanding Htaccess Redirect
Read more »


Post a Comment

9lessons:PHP Email Verification Script.

9lessons:PHP Email Verification Script.

Link to 9lessons Programming Blog

PHP Email Verification Script.

Posted: 12 Nov 2013 11:33 AM PST

I received lots tutorial requests from my readers in that most of them asked to me, how to implement email verification system using PHP. This is very basic tutorial explained how to create database and proper activation code. Implemented with mysqli_() fuctions, because mysql_() functions are depreciated.

PHP Email Verification Script.

Read more »


Post a Comment

9lessons:Outlook.com on a Custom Domain

9lessons:Outlook.com on a Custom Domain

Link to 9lessons Programming Blog

Outlook.com on a Custom Domain

Posted: 28 Oct 2013 11:43 AM PDT

Are you looking for free better email services for your domain? I suggest Outlook.com is the best option to setup your custom domain email service. This provides 50 member accounts free with all Outlook features like communicator, file storage etc. take a look this post follow the steps and setup your free Outlook account for your domain.

Outlook.com on a Custom Domain
Read more »


Post a Comment

9lessons:Understanding Regular Expression

9lessons:Understanding Regular Expression

Link to 9lessons Programming Blog

Understanding Regular Expression

Posted: 21 Oct 2013 11:22 AM PDT

Regular expression is the most important part in form validations and it is widely used for search, replace and web crawling systems. If you want to write a selector engine (used to find elements in a DOM), it should be possible with Regular Expressions. In this post we explained few tips that how to understand and write the Regular Expression in simple way.

10 Reasons To Get A .BLOG Name Now

Read more »


Post a Comment

9lessons:10 Reasons To Get A .BLOG Name Now

9lessons:10 Reasons To Get A .BLOG Name Now

Link to 9lessons Programming Blog

10 Reasons To Get A .BLOG Name Now

Posted: 18 Oct 2013 11:38 AM PDT

Blogging has become more than just a way for people to express themselves over the internet; it has become a way for people to connect over shared interests. With the relative ease of setting up a personal blog, many people from all ages and backgrounds have started blogging. Choosing what domain extension to use for your blog is one of the most important steps to creating a successful blog.

10 Reasons To Get A .BLOG Name Now

Read more »


Post a Comment

IPL Twenty20 Cricket

IPL Twenty20 Cricket


ICC World Twenty20 Qualifier 2013

Posted: 11 Oct 2013 05:16 AM PDT

DateMatch DetailsTime (IST)Place
Nov 15 - FriAfghanistan v Netherlands15:30Sharjah
Nov 16 - SatCanada v Ireland15:30Abu Dhabi
Nov 16 - SatAfghanistan v Scotland15:30Sharjah
Nov 19 - TueKenya v Scotland15:30Dubai
Nov 22 - FriNetherlands v Scotland11:30Dubai
Nov 23 - SatKenya v Netherlands11:30Dubai
Nov 24 - SunAfghanistan v Kenya15:30Sharjah

Pakistan vs South Africa in UAE 2013

Posted: 11 Oct 2013 04:30 AM PDT

DateMatch DetailsTime
(IST)
Place
Nov 13 - Wed1st T20I - South Africa v Pakistan21:30Dubai
Nov 15 - Fri2nd T20I - South Africa v Pakistan21:30Dubai


Post a Comment

9lessons:Customizing Google Maps

9lessons:Customizing Google Maps

Link to 9lessons Programming Blog

Customizing Google Maps

Posted: 07 Oct 2013 11:50 AM PDT

Do you know Google is providing an awesome feature, that you can create a totally customizable personalized Google Maps for your website based on theme colors. Today I want to explain how to customize and style Google Map from the scratch, just very few lines of code, this helps you to enrich your website design.

Customizing Google Maps

Read more »


Post a Comment

C Programming

C Programming


Flag Structure Design

Posted: 05 Oct 2013 01:07 AM PDT

Q. Write a C program to print the following flag design as:

 * * * * * * * * *
 * * * *
 * * * *
 * * * *
 * *
 * * * *
 * * * *
 * * * *
 * * * * * * * * *

Ans.

/*c program for flag design*/
#include<stdio.h>
int main()
{

 int num=7,r,c;
 for(c=1; c<=9; c++)
    printf(" *");
 printf("\n");
 for(r=1; r<=num; r++)
 {
  if(r==4)
  {
    for(c=1; c<=2; c++)
       printf(" *");
  }
  else
  {
    for(c=1; c<=4; c++)
       printf(" *");
  }
  printf("\n");
 }
 for(c=1; c<=9; c++)
    printf(" *");
 getch();
 return 0;
}

/**************************************************************
The output of above program would be:
***************************************************************/


Output of Flag Structure Design C program
Figure: Screen shot for flag-structure-design C program




Post a Comment

ComputerGeek

ComputerGeek


php.ini configuration file Default values

Posted: 02 Oct 2013 11:12 PM PDT

php.ini configuration file Default values The PHP configuration file(php.ini) is read when PHP is initialized. php.ini includes the core php.ini directives you can set these directives to configure your PHP setup.php.ini will be located at /usr/local/lib/php.ini OR /etc/php5/apache2/php.ini or /etc/php.ini php.ini default values: display_errors ;Default Value: On This determines whether


Post a Comment

C Programming

C Programming


Calculating Sum of Number of elements

Posted: 25 Sep 2013 12:04 PM PDT

Q. Write a C program to accept the number of elements to be insert from the user and calculate these elements sum.

For example:

if user enter no. of elements : 5
then he/she should enter elements value as:
Enter 1 element/number : 2
Enter 1 element/number : 7
Enter 1 element/number : 1
Enter 1 element/number : 10
Enter 1 element/number : 50
Result will be : 
Sum of elements/numbers : 70

Ans.

/*c program for entered number of elements and calculate the sum*/
#include<stdio.h>
int main()
{
 int num,arr[20],i,sum=0;
 //arr[20] value of changeable as big value

 printf("Enter number of element : ");
 scanf("%d", &num);
 for(i=1; i<=num; i++)
 {
    printf("Enter %d element : ",i);
    scanf("%d", &arr[i]);
 }
 for(i=1; i<=num; i++)
    sum = sum + arr[i];
 printf("\nSum of all numbers : %d",sum);
 getch();
 return 0;
}

/******************************************
The output of above program would be
*******************************************/


Output of Calculating Sum of Number of elements C program
Figure : Screen-shot for Calculating Sum of Number of
 elements C program



Post a Comment