Skip to main content

Posts

Program will accept Year,Month and Date from the user and will display the day of the month.

#include<stdio.h> #include<conio.h> #include<math.h> int isdatevalid( int month, int day, int year) { if (day <= 0) return 0 ; switch ( month ) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (day > 31) return 0 ; else return 1 ; case 4: case 6: case 9: case 11: if (day > 30) return 0 ; else return 1 ; case 2: if ( day > 29 ) return 0 ; if ( day < 29 ) return 1 ; else return 0 ; } return 0 ; } //------------------------------------------------ int fm( int date, int month, int year) { int fmonth,leap; //leap function 1 for leap & 0 for non-leap if ((year%100==0) && (year%400!=0)) leap=0; else if (year%4==0) leap=1; else leap=0; fmonth=3+(2-leap)*((month+2)/(2*month))+(5*month+month/9)/2; //f(m) formula fmonth = fmonth % 7; //bring it in range of 0 to 6 return fmonth; } //---------------------------------------------- int day_of_week( int date, int month, int year) { int ...

Write a C program that reads the customer number and power consumed and prints the amount to be paid by the customer.

An electric power distribution company charges its domestic consumers as follows. Consumption Rate of Units Charge ------------------------------------------------------ 0-200 Rs.0.50 per unit 201-400 Rs.100 plus Rs.0.65 per unit excess 200 401-600 Rs.230 plus Rs.0.80 per unit excess of 400. #include<stdio.h> #include<conio.h> void main() { int n, p; float amount; clrscr(); printf( "Enter the customer number: " ); scanf( "%d" ,&n); printf( "Enter the power consumed: " ); scanf( "%d" ,&p); if (p>=0 && p<=200) amount=p*0.50; else if (p>200 && p<400) amount = 100+((p-200) * 0.65); else if (p>400 && p<=600) amount = 230 + ((p-400) * 0.80); printf( "Amount to be paid by customer no. %d is Rs.:%5.2f." ,n,amount); getch(); } Output : Enter the customer number: 1 Enter the power consumed: 100 Amount to be paid by customer no. 1 is Rs.:50.00. ...

Running Clock in C++ with Graphics

#include<conio.h> #include<graphics.h> #include<math.h> #include<dos.h> #define WBC 5 //^watchbackcolor #define X 200 #define Y 200 void dial( int x, int y); void sechand( int timeminute); void minhand( int t) { int x1,y1; setlinestyle(0,0,3); x1= X+ (80 * cos(t*0.1047)); y1= Y+ (80 * sin(t*0.1047)); setcolor(BLACK); line( X, Y, x1, y1); setcolor(WBC+1); line( X, Y, X+ 80 * cos((t-1)*0.1047),Y+ 80 * sin((t-1)*0.1047)); circle(X,Y,4); } void sechand( int t) { int x1,y1; setlinestyle(0,0,3); x1= X+(100 * cos(t*0.1047)); y1= Y+(100 * sin(t*0.1047)); setcolor(RED); line(X, Y, x1, y1); setcolor(WBC+1); line(X, Y, X+ 100 * cos((t-1)*0.1047),Y+ 100 * sin((t-1)*0.1047)); circle(X,Y,4); } void dial( int x, int y) { int const size=200; setfillstyle(1,WBC); fillellipse(x,y,size,size); setfillstyle(1,WBC+1); fillellipse(x,y,size-20,size-20); outtextxy(x,y-(size-40), "12" ); outtextxy(x,y+(size-40), "6" ); outtextxy(x+(s...

Installation Steps For Installing TurboC compiler

This guide will explain how to install the TurboC compiler onto the C: drive but you can choose any drive and location that you wish. Following are the steps to install the TurboC compiler: 1. Copy the truboC.exe file onto the C: drive of your computer. 2. Double-click the truboC.exe file. The Open File – Security Warning dialog box appears, as shown in the following figure. 3. Click the Run button in the Open File – Security Warning dialog box. The WinZip Self-Extractor – turboC.exe dialog box appears, as shown in the following figure. 4. Click the Unzip button. All the files get unzipped and stored in the C:\tctemp folder. If you want, you can change the name and location of the folder. 5. Double-click the C:\tctemp folder. This displays the contents of the folder. 6. Double-click the INSTALL.EXE file. The following window is displayed. 7. Press the ENTER key. The following widow is displayed. 8. Type C as the source drive in the Enter the SOURCE drive to use box. 9....

Android Programming Tutorials, 3rd Edition

There are two major steps for getting started with Android: 1. Y ou need to install the Android SDK and developer tools 2. Y ou should build a test project to confirm that those tools are properly installed and configured If you have already done some form of "hello, world" project with the development tools on your development machine, you can skip this tutorial. If you have not yet installed the Android SDK and related tools, there is an appendix that covers this process. Once you have the Android SDK, it is time to make your first Android project. The good news is that this requires zero lines of code – Android's tools create a "Hello, world!" application for you as part of creating a new project. All you need to do is build it, install it, and see it come up on your emulator or device. That is what this tutorial is for.

CUSTOMER ENGAGEMENT Highlights-North (NIIT)

Arithmetic Example in JSP using NetBeans

  Create Arithmetic.jsp <% -- Document : Arithmetic Created on : Mar 21, 2012, 1:03:10 AM Author : dell_pc --%> <%@page contentType=" text/html " pageEncoding=" UTF-8 "%> <!DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN " " http://www.w3.org/TR/html4/loose.dtd "> <html> <head> <meta http-equiv=" Content-Type " content=" text/html; charset=UTF-8 "> <title>Arithmetic Example</title> </head> <h1> Some Arithmetic Example in JSP</h1> <body> a = 13; b = 3; <% int a = 15; int b = 7; int result1 = a + b; { out.println(" <br/> Additon of a and b = " + result1); out. print (" <br> "); ...