-->

Facebook

Jasper Roberts - Blog

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.

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 07

1. Explain malloc and calloc.
2. What is dynamic memory allocation? Explain it.

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.

Punishment : if not completed by today,
3 times assignment 1 and 5 times practical set 1 into the class book.

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.

Types of Constants in C Language

Types of Constants

Thursday, October 2, 2014

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
c is largest number.



DOWNLOAD          DOWNLOAD
download nested if else statement            download nested if else statement

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
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.


DOWNLOAD          DOWNLOAD
           




if statement

if statement(s):

- in if statement, if the condition is true than it will execute the block of statements.

- if the condition is false then it will not execute the block of statement.




-   Syntax:
               if(condition)
               {
                          statement(s);
                }




-   Flow chart:
if statement
if statement




   - Example: A C program to check the student is pass.

#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.”);
     }
    
     getch();
}


OUTPUT:
enter the percentage: 65
Student is pass.


DOWNLOAD          DOWNLOAD