Skip to main content

Posts

Showing posts from May, 2012

Featured Post

Data Mining with Weka -Installation

Weka - Data mining Tool W eka is a tool for big data and data mining. It is used to various classification, experiments, and analysis over large data sets. Installation Guide -weka  You can download Weka from   here   and follow the normal installation procedure. After completion you will get following window, here you can begin your classification or experiment on different data sets with Weka.

C- program (Sequence) lowerToUPPER case

18. Write a program to enter character from a to z or A to Z and convert into lowercase and vice-versa. #include <stdio.h> #include <conio.h> void main () { char ch; printf ("Enter the character:"); scanf ("% c", & ch); if (ch> 64 && ch <94) printf ("% c", ch + 32); else printf ("% c", ch-32);  getch (); }

C-program(Sequence) DayOnWeek-MenuDriven

  19. Write a program to display the name of day in a week, depending upon the number entered through #include <stdio.h> #include <conio.h> #include <process.h> void main () { int day; printf ("\ n Enter the number between 1 to 7:"); scanf ("% d", & day); switch (day) {  case 1: printf ("\ nSunday");   break;  case 2: printf ("\ n Monday");   break;  case 3: printf ("\ n Tuesday");   break;  case 4: printf ("\ n Wednesday");   break;  case 5: printf ("\ nThursday");   break;  case 6: printf ("\ n Friday");   break;  case 7: printf ("\ n Saturday");   break;  default:   printf ("Wrong Entry");    exit (0);    }    getch ();    }

C-program (sequence) Mark sheet

C-program (sequence) Mark sheet 15. Write a Program to input name, class and marks in five Subjects like English, math, Nepali, account, Computer science Find Total, percentage, division, remarks The condition of division is.. : Percentage / Division: per> = 75 / Distinction, per> = 60 AND per <75 / First per> = 45 AND per <60 / Second, per> = 35 AND per <45 / Third and Below-35 / Fail. #include <stdio.h> #include <conio.h> void main () { char name [50]; int clas, eng, nep, math, acc, cscience, total; float per; printf ("Enter the name of student:"); scanf ("% s", & name); printf ("Enter the class:"); scanf ("% d", & clas); printf ("Enter the marks in English, Nepali, Math, Account and Computer Science."); scanf ("% d% d% d% d% d", & eng, & nep, & math, & acc, & cscience); printf ("\ t \ nName =% s", name); printf ("\ t \ nClass =

C-program(Sequence) Age group display

14. Write a program to find age group on the basis of age . Age/Group: 0-10/Child, 10-19/Teenage, 19-40/Young, Above40/Old. #include<stdio.h> #include<conio.h> void main() { int age; printf("Enter the age of person:"); scanf("%d",&age); if(age>0 && age<=10) printf("Child"); else if(age>10 && age<=19)   printf("Teenage");   else if(age>19 && age<=40)   printf("Young");   else   printf("Old");   getc h(); }

C-program (sequence) - Test Character

 13. Write a Program to Test WHETHER Character is the entered digit alpha or alpha or Special Character Character on the Basis of Given condition. Character / Message: 0-9 / Alpha digit, AZ / Alpha Character, Others / Special Character. #include <stdio.h> #include <conio.h> void main () {  char ch;  printf ("Enter character:");  scanf ("% c", & ch);  if (ch> = '1' && ch <= '9')  printf ("Alpha Digit");  else if (ch> = 'a' && ch <= 'z')  printf ("Alpha character");  else  printf ("Special Character");  getch (); }

C - Programs (Sequence) Middle number among three

11. Write a program to enter any three numbers and find out the middle number. #include <stdio.h> #include <conio.h> void main () { // X: int a, b, c; printf ("Enter any three numbers:"); scanf ("% d% d% d", & a, & b, & c); if ((a> b && a <c) || ​​(a <b && a >c)) printf ("% d is middle number", a); else if ((b> a && b <c) || ​​(b <a && b >c)) printf ("% d is middle number", b); else if ((c> a && c <b) || (c <a && c> b)) printf ("% d is middle number", c); else { printf ("Wrong data entry"); // Goto x; }  getch (); }

C - Program (Sequence)- Arithmetic operations

5. Write a program to read any two numbers through the keyboard and to perform arithmetic operations (ie addition, subtraction, multiplication and division) and display the result using scanf and printf function. #include <stdio.h> #include <conio.h> void main () {   int x, y, add, sub, mul, div;   printf ("Enter the value of x and y:");   scanf ("% d% d", & x, & y);   add = x + y;   sub = xy;   mul = x * y;   div = x / y;   printf ("\ nAddition =% d", add);   printf ("\ nSubtraction =% d", sub);   printf ("\ nMultiplication =% d", mul);   printf ("\ nDivision =% d", div);   getch (); }

C - Program (Sequence) - Quadratic Equation

4.Write a program to solve the quadratic equation ax ^ 2 + bx + c = 0, where x = (√-b + -b ^ 2-4ac) / 2a. #include <stdio.h> #include <conio.h> #include <math.h> void main () {   int a, b, c;   float x, y;   printf ("Enter the value of a, b & c =");   scanf ("% d% d% d", & a, & b, & c);   x = pow ((- b + b * b-4 * a * c), 0.5) / 2 * a;   y = pow ((- bb * b-4 * a * c), 0.5) / 2 * a;   printf ("value of x =% f", x);   printf ("value of y =% f", y);   getch (); }

Program (Sequence) - Area and Volume

3.Write a Program  Asking length (L), Breadth (B) and Height (h) of a room. Calculate ITS Area of Floor (af), Area of Wall (AW) and Volume (V). #include <stdio.h> #include <conio.h> void main () {   int l, b, h, af, aw, v;   printf ("Enter Length, Breadth and Height:");   scanf ("% d% d% d", & l, & b, & h);   af = l * b;   aw = 2 * h * (l + b);   v = l * b * h;   printf ("Area of ​​floor =% d \ n", af);   printf ("Area of ​​wall =% d \ n", aw);   printf ("Volume of a room =% d", v);   getch (); }

C - Program (Sequence) - Convert Temperature

2.Write a program to convert temperature in fahrenheit (F) into antigrade (c) [F = 1.8c + 32]. #include <stdio.h> #include <conio.h> void main () {   int f;   float c;   printf ("\ n Enter the temperature in Fahrenheit:");   scanf ("% d", & f);   c = (f-32) /1.8;   printf ("\ n Temperature in antigrade is:% f", c);   getch (); }

C - Program (Sequence) - Circumference of Circle

1. WAP to find area and circumfernce of a circle, where define pi as constant. #include <stdio.h> #include <conio.h> #define pi 3.14 void main () {     int r;     float a, c;     printf ("\ n Enter the radius:");     scanf ("% d", & r);     a = pi * r * r;     c = 2 * pi * r;     printf ("\ nArea of ​​a circle is =% f", a);     printf ("\ n \ nCricumference of a circle is =% f", c);     getch (); }

Format Specifier Used in 'C'

Format specifier are characters starting with% sign and followed with a character. It identifies the data type that is being processed. It is also known as "Conversion Specifier". Data Type                             Format Specifier symbol Integer                                                             % d Unsigned Integer% u Octal% o Hexadecimal% x Float% f Float (Scientific)% e Character% C String% s

Escape Sequence in 'C'

These are the character not printed when used but provide various functions.  Escape Sequences are always started with a backslash '\' Commonly used  escape sequence are: Character Escape Sequence Bell (alert) \ a Backspace \ b Horizontal tab \ t Newline \ n Carriage return \ r Quotation \ " Backslash \\ null \ 0 etc.

Keywords use in 'C'

auto char int float for continue default case const if else enum goto long short static struct switch typedef union register signed extern unsigned void while return break near far double

Data Type In 'C'

Data Types Data Type Data Sub_Type Byte Format Range Character Signed Character  1  % C -128 To 127 Unsigned Character  1  % C 0 to 255 (Numeric) Integer Short signed int  2  % D -32768 To 32767 Short Unsigned int  2  % D 0 to 65535 Long Integer Long Signed int  4  % Ld -2147483648 To 2147483647 Long Unsigned int  4  % Ld 0 to 4994967295 Float Float  4  % F 3.4E-38 to 3.4E + 38 Double Double  8  % Lf 1.7E-308 to 1.7E + 308 Long Double  10  % Lf 3.4E-4932 to 3.4E + 4932

Programming language (C)

It is structured programming language  which is used to develop operating system,  business system, text processing, database management etc.  It was developed by Dennis Ritche  in 1970 at AT and T Bell Laboratories.  Every function of C is accompanied by  their separate header file.