Thursday, September 29, 2011

WAP to perform this :: 123->one two three

#include<stdio.h>
#include<conio.h>
int rev(int);
void main()
{
    int num,a,rem,sum;
    clrscr();
    printf("enter a number");
    scanf("%d",&num);
    a=rev(num);
    while(a>0)
    {
        rem=a%10;
        a=a/10;
switch(rem)
{
case 1:
printf("one\n");
break;

case 2:
printf("two\n");
break;

case 3:
printf("three");
break;

case 4:
printf("four");
break;

case 5:
printf("five");
break;

case 6:
printf("six");
break;

case 7:
printf("seven");
break;

case 8:
printf("eight");
break;

case 9:
printf("nine");
break;

case 0:
printf("zero");
break;

default:
printf("wrong input");
}
}
getch();

}
int rev(int num)

WAP to convert 10 base number into base 2, base 8, base 16

#include<stdio.h>
#include<conio.h>
con(int,int);
void main()
{
int num,ch;
clrscr();
printf("enter a  decimal number\n");
scanf("%d",&num);
printf("1-binary\n");
printf("2-hexadecimal\n");
printf("3-ocatal\n");
printf("\n");
printf("enter your choice\n");
scanf("%d",&ch);

WAP to show use of ceil and floor function

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float x=1.66;
float y=1.75;
clrscr();
printf("%f\n%f",ceil(y),floor(x));
getch();
}

o/p
x=2.000000
y=1.000000


WAP to find absolute value of a number

#include<stdio.h>
#include<conio.h>
void main()
{
    int num;
    clrscr();
    printf("enter the number");
    scanf("%d",&num);
    if(num<0)
    {
        num=-num;
        printf("the absolute of no. is %d",num);
    }
    else
    {
        printf("the absolute of no. is %d",num);
    }
        getch();
}

Wap to calculate Library Fine

#include<stdio.h>
#include<conio.h>
void main()
{
int day;
float fine;
clrscr();
printf("enter the  no. of dates the member is lateto return the book :");
scanf("%d",&day);
if (day>0 && day<=5)

Tuesday, September 27, 2011

Some objective question in c



Subject: Computers                                                                    MM: 25
Code     : PCS151                                                                     Time: 20 Minutes
--------------------------------------------------------------------------------------------------------
Note: 1.  All questions carry equal marks. No negative marking.
           2. Do not write or mark anything on question paper.
--------------------------------------------------------------------------------------------------------

Q1-C is written by:
A. Dennis Ritchie                                                        B. strostrup                   
C. Daniela                                                                      D. None

Q2.A pixel is
A. A computer program that draws picture                        B. A picture stored in secondary memory
C. The smallest resolvable part of picture                   D. None of these

Q3.Which of the following is not a keyword:
A. long                                                                             B. int                     
 C. float                                                                            D. main

Q4.Which of the following is not a format specifier:
A. %d              B. %i                           C. %e               D. %#x                        E. none

Wednesday, September 21, 2011

WAP to find the size of all data types


 
// program to find the size of all data types                                 

#include<stdio.h>                                                            
#include<conio.h>                                                            
void main()                                                                   
{                                                                            
 clrscr();                                                                   
 printf("\n The number of bytes int takes is %d", sizeof(int));              
 printf("\n The number of bytes float takes is %d", sizeof(float));          
 printf("\n The number of bytes double take is%d",sizeof(double));        
 printf("\n The size of bytes char takes is %d",sizeof(char));               
 printf("\n The size of bytes long takes is %d",sizeof(long));               
 printf("\n----------------");                                               
 getch();                                                                     
}                                                                            

Output:
The number of bytes int takes is 2
The number of bytes float takes is 4
The number of bytes double takes is 8
The number of bytes char takes is 1
The number of bytes long takes is 4
____________________________
      



Sunday, September 18, 2011

How to generate sound in Turbo C..

#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
clrscr();
printf("sa...................\n");
sound(600);                      
delay(1000);
nosound();

printf("re...................\n");
sound(700);
delay(1000);
nosound();

Saturday, September 17, 2011

Question list of selection..


SELECTION
1-WAP TO FIND WHETHER A GIVEN NUMBER IS EVEN OR ODD (using if, if-else)?

2-WAP TO FIND WHETHER A GIVEN NUMBER IS POSITIVE, NEGATIVE, OR ZERO?

3-WAP TO CALCULATE THE ABSOLUTE VALUE?

4- THE FOLLOWING CALCULATES VALUE OF F(X) IF X HAS DIFFERENT RANGES OF VALUE AS BELOW
F(X) =X2+2                              IF         0<=X<=10
F(X) =X2+2X                           IF         11<=X<=20
F(X) =X3+2X2                         IF         21<=X<=30
F(X) =0                                    IF         X>30
5-WAP TO FIND THE LARGEST OF THREE NUMBERS AND GIVE THE OUTPUT IN ASCENDING ORDER?

6-Any year is entered through the keyboard, write a program to DETERMINE WHETHER the year is leap year or not.

7-WAP TO FIND THE SIMPLE INTEREST IF PRINCIPAL AMOUNT IS LESS THAN 10000 ELSE CALCULATES COMPUND INTEREST?

8- POGRAM TO find grade of the student for four subjects marks for each subject to be entered   by the user.

            Per>=85                                               grade=A
            Per<85 and per>=70                            grade=B
            Per<70 and per>=55                            grade=C
            Per<55 and per>=40                            grade=D
            Per<40                                                 grade=F

9-WAP TO CALCULATE THE BILL FOR A SHOPKEEPER WHO SALES MANGO @ 5 RS per MANGO.IF BILL IS GREATER THAN 500 THAN GIVE DISCOUNT OF 10%. ELSE NO DISCOUNT.

10-WAP TO INPUT THREE SIDE OF A TRAINGLE THEN VALIDATES IT. IF TRAINGLE IS VALID ALSO CALCULATE AREA OF TRIANGLE.

11-WAP TO SIMULATE THE CALCULATOR USING SWITCH STATEMENT?

12-WAP TO FIND WHETHER A GIVEN CHARACTER IS VOWEL OR CONSONANT?

13-Any character is entered through the keyboard, write a program to determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol.

14-If the three sides of a triangle are entered through the KEYBOARD; WRITE a program to check whether the triangle is isosceles, equilateral, scalene or right angled triangle.


15-WAP TO FIND LARGER NUMBER BETWEEN TWO NUMBERS.

16- A library charges a fine for every book returned late. For first 5 days the fine is 50 rupees, FOR 6-10 days fine is 100 rupee and above 10 days fine is 150 rupees. If you return the book after 30 days your membership will be cancelled. Write a program to accept the number of days the member is late to return the book and display the fine or the appropriate message.

17-wap to detect person has made profit or loss.(input cost price and sell price.).also calculate profit and loss?

18-wap to find sqrt, LOG, EXP of a given number using switch case?

solution of these question will be after a short time...





Question list of sequence..


SEQUENCE
1-WAP TO PRINT “HELLO WORLD” USING C  (WITH DOCUMENTATION).

2-WAP TO PRINT VALUE OF VARIABLES OF ALL BASIC TYPE

3-WAP TO FIND SUM OF TWO NUMBERS WITHOUT USING SCANF ( )

4-WAP TO FIND SIMPLE INTEREST W/O USING SCANF ()

5-WAP TO DEMONSTRATE USE OF ALL ESCAPE CHARACTER (\n,\t,\a etc)

6-WAP TO COMPUTE NET SALARY? (NS=BP+HRA+TA +DA)
      WHERE BP (BASIC PAY WOULD BE ENTER BY USER)
       HRA=10% OF BP
      TA=5%OF BP
      DA=15%OF BP.

7-WAP TO CONVERT TEMPERATURE FROM FAHRENHEIT TO  CENTIGRADE.

8- HEMANT’S BASIC SALARY IS INPUT THROUGH THE KEYBOARD. HIS DEARNESS ALLOWANCE IS 40% OF BASIC SALARY, AND HOUSE RENT ALLOWANCE IS 20% OF BASIC SALARY. WRITE A PROGRAM TO CALCULATE HIS GROSS SALARY.


9-   IF THE MARKS OBTAINED BY A STUDENT IN FIVE DIFFERENT SUBJECTS ARE INPUT THROUGH THE KEYBOARD, FIND OUT THE AGGREGATE MARKS AND PERCENTAGE MARKS OBTAINED BY THE STUDENT. ASSUME THAT THE MAXIMUM MARKS THAT CAN BE OBTAINED BY A STUDENT IN EACH SUBJECT IS 100.

10- THE LENGTH & BREADTH OF A RECTANGLE AND RADIUS OF A CIRCLE ARE INPUT THROUGH THE KEYBOARD. WRITE A PROGRAM TO CALCULATE THE AREA & PERIMETER OF THE RECTANGLE, AND THE AREA & CIRCUMFERENCE OF THE CIRCLE.

11-WAP TO FIND A RAISED TO THE POWER B USING POW () FUNCTION.

12-WAP TO FIND ROOTS OF A QUADRATIC EQUATION?

EQ IS OF FORM (AX2+BX+C=0).


SOLUTION OF THESE QUESTION WILL BE AFTER SHORT TIME....