Академический Документы
Профессиональный Документы
Культура Документы
RADHIKA THAKUR Registration no.- 11111736 Roll No. E1R03A52 Section- E1RO3
Date of allotment:-23-1-2012 Date of submission:-2-2-2012 Submitted toMR. MAKUL MAHAJAN
Que.1
The marks obtained by a students in 5 different subjects are input through the keyboard. The student gets a division as per following rules. 1-percentage above or equal to 60 first division 2-percentage between 50 and 59- second division 3-percentage between 40 and 49- third division 4-percentage less than 40 condition . - fail
ANS:-
Que.2 If a=10, b=12, c=0 , find the values of expressions in the following table...
Que.3 A library charges a fine form every book returned late . For first 3 days the fine is 50 paise, for 6-10 days fine is 1 rupee and above 1 0 days fine is 5 Rs. If you return the book after 30 days your membership will be cancelled . Write a program to accept the no. O days the member is late to return the book and display the fine on the appropriate message. Ans:#include<stdio.h> # include<conio.h> Main() { Int n; Printf(enter the no. Of days);
Scanf(%d,&n); If(n<=5) Printf(fine is 0.50 paisa); Else if(n>5&&n<=10) Printf(fine is 1 Rs); Elseif(n>10&&n<=30) Printf(fine is 5 Rs); Else Printf(your membership is cancelled); Getch(); } Que 4 How a source program converted to an executable program in c. Make a flow chart for the entire process? ANS:-
Operator ! ++ --
For example:- * Increment: ++x, x++ * Decrement: x, x * Address: &x * Indirection: *x * Logical negation: !x
Tertiary operators are operators that deal with three arguments( condition, true result, false result) which can be anything from a constant to a complete boolean expression.
TERNARY:- 2.
used to compare two values or expressions. It is used to compare numbers, strings, Boolean values, variables, objects, arrays, or functions. 2. Equal to operator in C language is used to check the value of left hand variable/expression with the right hand variable/expression. whether the two values are equal or
not. It returns true if these are equal else it will return false.
EXPRESSION AND STATEMENT:EXPRESSION:- 1 The smallest unit of computation. An expression consists of one or more operands and usually an operator. 2 Expression are evaluated to produce a result. For example :assuming i and j are ints, then i + j is an arithmetic addition expression and yields the sum of the two int values. STATEMENT:- 1 Statement is an instruction to the computer telling it what to do for instance assigning an expression value to a variable , cause it produces an instructions tells the computer to assign a value to something. For example:- This code does not do anything other than calculates a result. The following is a statement: x=2+3;
Identifier can be name of any variable or any name used to identify an object or entity .hence keywords cannot be used as an identifier. For example:
IDENTIFIER:-
int x; Here, the identifier is "x," but the variable is the object whose name is "x." Keywords are reserved words like(static,public......) which has a special meaning for compilers. E.g. :- auto, short, long etc.
KEYWORDS:-
SIGNED AND UNSIGNED INTEGERS:signed integers can hold both positive and negative numbers.
SIGNED:-
QUE.6:- Write a program to print out all Armstrong numbers between 1 to 500. If sum of cubes of each digit of a number it self then the number is called an Armstrong number. For example 153=(1*1*1)+(5*5*5)+(3*3*3)
Ans:- #include <stdio.h> #include <conio.h> main() { int i=1,a,b,c; printf(Armstrong number between1 to 500 ); while (i<=500) { a=i%10; /*Extract Last Digit */ b=i%100; b=(b-a)/10; /*Extract First Digit */ c=i/100;/*Extract first Digit*/