Tuesday, December 30, 2014
Thursday, December 25, 2014
CPU MOST IMPORTANT QUESTIONS(QUESTION BANK)
Q
– 1: Justify
“C is Middle Level Language”.
Q
– 2:Give the
difference between:
a. Compiler and Interpreter.
b. Application software and system software.
c. Call by value and call by reference.
Q
– 3:What is
an algorithm? Write an algorithm to display sum of n numbers.
Q
– 4:What is
flowchart? Explain various symbols used in Flowchart and draw the flowchart for
finding smallest number out of three given numbers.
Q
– 5: Explain
various data types of C language.
Q
– 6:Explain
various operators used in C language.
Q
– 7:Explain
while…loop and do…while loop giving their syntax.
Q
– 8:Explain if…else
with suitable example.
Monday, November 3, 2014
Write a c program to reverse a given integer number.
#include<conio.h>
#include<stdio.h>
void main()
{
int num,i;
clrscr();
printf("Enter the number:");
scanf("%d",&num);
#include<stdio.h>
void main()
{
int num,i;
clrscr();
printf("Enter the number:");
scanf("%d",&num);
Write a c program to print first N Fibonacci Numbers.
#include<conio.h>
#include<stdio.h>
void main()
{
int num1, num2, num3, n;
int count;
clrscr();
num1 = 0;
num2 = 1;
Friday, October 17, 2014
Important Questions for Mid-Sem Exam - 2014
1. What is software? explain types of software.
2. What is algortihm? Give an example.
3. What is computer? Draw the block diagram for computer system and explain input and output devices.
4. Write a short note on operators in details.
2. What is algortihm? Give an example.
3. What is computer? Draw the block diagram for computer system and explain input and output devices.
4. Write a short note on operators in details.
Thursday, October 16, 2014
Array
- Array is a
collection of variables of same type known by a one name.
- The
individual elements of an array are referred by their index or subscript value.
- Arrays can
be divided into two categories.
1.
One Dimensional Array
2.
Multi Dimensional Array
1. One Dimensional Array
- The syntax
for declaring a one dimensional array is:
DataType
ArrayName[Size];
Wednesday, October 15, 2014
Write a c program to print first n Fibonacci numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
int
num1=0, num2=1, num3, n, i;
clrscr();
Write a c program to reverse a given number.
#include<stdio.h>
#include<conio.h>
void main()
{
int
num, i;
clrscr();
printf(“Enter
the number:”);
Tuesday, October 14, 2014
write a c program to draw following pattern-7
/*
AAAAA
BBBB
CCC
DD
E
*/
#include<stdio.h>
#include<stdio.h>
void main()
{
int i, j;
clrscr();
for(i=1;i<=5;i++)
write a c program to draw the following pattern-6.
/*
A
AB
ABC
ABCD
ABCDE
*/
#include
<stdio.h>
#include
<conio.h>
void main()
{
int i, j;
clrscr();
Write a c program to draw the following pattern-5.
/*
12345
2345
345
45
5
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int
i,j;
clrscr();
for(i=1;i<=5;i++)
{
The getchar() & putchar() functions
getchar()
-
reads only single
character at a time.
-
It can be used in the
loop if there is need to read more than one characters from the screen.
putchar()
-
This function puts only
single character at a time.
Monday, October 13, 2014
Write a C Program to draw following patter-4.
/*
1
10
101
1010
10101
*/
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++);
{
Write a C Program to draw following patter-3.
/*
1
22
333
4444
55555
*/
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++);
{
printf(“%d”,i);
Write a C Program to draw following patter-2.
/*
1
12
123
1234
12345
*/
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++);
Write a C Program to draw following patter -1
/*
*
**
***
****
*****
*/
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++);
{
WRITE A C PROGRAM TO CALCULATE SUM OF N NUMBERS.
#include<stdio.h>
#include<conio.h>
void main()
{
int
i=1,sum=0,no;
clrscr();
printf(“Enter
the number:”);
scanf(“%d”,&no);
while(i<=no)
{
Friday, October 10, 2014
Assignment 06
1.
What is structure? How do we declare and access
structure variables?
2.
Explain nested structure with example.
Assignment 05
1. List out the category of functions. Explain all with
example.
2. Write a program to demonstrate the “call by value” and
“call by reference” concept in C.
Assignment 04
1.
What is array? What are the advantages to use array?
2.
Explain following with example:
§ One
dimensional array
§ Two
dimensional array
§ Multi
dimensional array
Assignment 03
1.
Explain decision making with ‘if’ statement with example.
2.
Explain decision making with ‘if…else’ statement
with example.
3.
Explain nesting of ‘if…else’ with example.
Tuesday, October 7, 2014
Basic of Looping Structures
-
In certain situation in programming, statement(s)
are required to be repeated for fixed number of times or till certain condition
is satisfied.
-
C language provides looping structures so that we
need not to write those statement(s) again and again in our program. If the
Write a program to find sum of first N odd numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
int i, num, odd=0,
even=0;
clrscr();
printf(“Enter the number:”);
scanf(“%d”,&num);
for(i=1;i<=num,i++)
Submit Assignment 1 and Practical Set 1
This is to inform you that today is last date of submission of Assignment 1 and Practical Set 1.
Today, You are not able to submit than have to suffer punishment.Monday, October 6, 2014
Write a program to find sum of all integers greater than 100 & less than 200 and are divisible by 5.
#include<stdio.h>
#include<conio.h>
void main()
{
int
i, sum=0;
Write a program to print 1+1/2+1/3+1/4+....+1/N series.
#include<conio.h>
#include<stdio.h>
void main()
{
double i, n, sum = 0;
clrscr();
printf("enter the
number:");
scanf("%lf",&n);
Features / Importance of C.
- C
is a robust:
C language provides 32 keywords. It has a
rich set of functions and operators. We can use them to write any complex programs.
- C
is fast and efficient:
C language consists of variety of data types
and powerful operators which makes it faster.
Saturday, October 4, 2014
CPU(2110003) Assignment - 2
1. Write a short note on data types.
2. What is constant? Explain numerical constant and non-numerical constant.
2. What is constant? Explain numerical constant and non-numerical constant.
Thursday, October 2, 2014
DOWNLOAD GTU PAPERS OF CPU 2110003
CLICK HERE TO DOWNLOAD....
Wednesday, October 1, 2014
Nested if-else statement:
- The
if-else statement provides two way decisions only.
- Sometimes,
decisions must be made between more than two possibilities.
- At that
time, we can use nested-if else statement.
- C
language provides nested-if else. Nested if else means loop within loop.
- In, nested
if else statement, if the condition is true than statement(s)-1 (or statement(s)-2)
is executed.
- If the
condition is false then statement(s)-3 (or statement(s)-4) is executed.
- Syntax:
if(condition)
{
if(condition)
{
Statement(s)-1;
}
else
{
Statement(s)-2;
}
else
{
if(condition)
{
Statement(s)-3;
}
else
{
Statement(s)-4;
}
}
- Example: A C program to find out the largest number among three
numbers.
#include<stdio.h>
#include<conio.h>
void
main()
{
int a,b,c;
clrscr();
printf("Enter the values of a: ");
scanf("%d",&a);
printf("Enter the values of b: ");
scanf("%d",&b);
printf("Enter the values of c: ");
scanf("%d",&c);
if(a>b)
{
if(a>c)
{
printf(" a is largest number.");
}
else
{
printf(" c is largest number.");
}
}
else
{
if(b>c)
{
printf(" b is largest number.");
}
else
{
printf(" c is largest number.");
}
}
getch();
}
OUTPUT:
Enter the values of a:15
Enter the values of b:25
Enter the values of c:45
if else statement
- In, if else
statement, if the condition is true than statement(s)-1 is executed.
- If the
condition is false then statement(s)-2 is executed.
- Syntax:
if(condition)
{
Statement(s)-1;
}
else
{
Statement(s)-2;
}
- Flow chart:
if else statement |
- Example: A C program to check the student is pass or fail.
#include<conio.h>
#include<stdio.h>
void main()
{
float
per;
clrscr();
printf(“enter
the percentage:”);
scanf(“%f”,&per);
if(per>35)
{
printf(“Student
is pass.”);
}
else
{
Printf(“Student
is fail.”);
}
getch();
}
OUTPUT:
enter the percentage: 28
Student is fail.
Subscribe to:
Posts (Atom)