C Language
Introduction
Fill in the blanks
1. Who is the author of C Dennis Ritchie
2. C language is developed from B language
3. C language is Middle level
language
4. C uses Operating system
5. Which year was C language invented 1970
6. Which year was C language is Released
1972
7. Int byte value 2
8. Long int byte value 4
9. Float byte value 4
10.
Char byte value 1
11.
Double byte value 8
12.
Char a[5]=”Mango”.string byte value 5
13.
Write single line comment //
14.
Write multiline comment /* */
15.
Write a escape sequence for new line
\n
16.
Scanf used to print the value [T/F].
False
17.
Printf used to store the value[T/F].
True
18.
Write a escape sequence for tab space \t
19.
Write a comment to printing a float 2 presicion %0.2f
20.
Write a symbol for preprocessor #
Answer the following Question
1. Write
C language history, Features , Characteristics and uses.
C
Languge History:
·
C
Language author (Dennis Ritchie)
·
C
is Developed for operating system- os(windows,linux,unix)
·
C
author is Dennis Ritchie - 1970
·
C
language published on 1972
·
C
language developed from
B Language ,BCPL(Basic Computer Programming language).
·
ANSI
- American National standard Institute -1983
·
in
advanced version of c released -1989
·
first
copy is Released on 1990
Features’
Of C :
*Modularity
*Code Reusability
* Limited Number of Keyword
* Portability
* Ability to Extend Itself
Characteristics of c:
*c- Structure (OR) procedure oriented
language
*c- case
sensitive
*c- top down
approach
*Small Size (memory)
*Structured Language
*It has high level construct
*It can handle low level activities
*It can be compiled on a variety of
computer
USES OF C:
*Operating System
*Editors (Note pad, word pad, ms office)
*File utilities
*Compile
*Performance Enhancer
2. Write a Runtime Program.
#include <stdio.h>
#include <conio.h>
main()
{
int a;
clrscr();
printf(“enter a and b value”);
scanf(“%d%d” &a,&b);
printf(“a value=%d\n b value=%d”,a,b);
getch();
}
3. To Print your name using String.
#include <stdio.h>
#include <conio.h>
main()
{
char a[20];
clrscr();
printf(“enter your name”);
scanf(“%s” &a);
printf(“your name=%s”,a);
getch();
}
4. Write a Program to convert lower case
to upper case and Upper case to lower case.
Lower case to Upper case
#include <stdio.h>
#include <conio.h>
main()
{
char a;
clrscr();
printf(“enter any character”);
scanf(“%c” &a);
printf(“Upper case=%c”,a-32);
getch();
}
Upper case to Lower case
#include <stdio.h>
#include <conio.h>
main()
{
char a;
clrscr();
printf(“enter any character”);
scanf(“%c” &a);
printf(“Lower case=%c”,a+32);
getch();
}
5. Write a program for below Equation.
A=Ï€r2
Ï€=3.14
r=1.5
#include <stdio.h>
#include <conio.h>
main()
{
float r,A;
clrscr();
printf(“enter radius value”);
scanf(“%f”, &r);
A=3.14*r*r;
printf(“Area=%d”,A);
getch();
}
6. Write a program for below Equation.
A=2Ï€r
Ï€=3.14
r=7
#include <stdio.h>
#include <conio.h>
main()
{
int r,A;
clrscr();
printf(“enter radius value”);
scanf(“%d”, &r);
A=2*3.14*r;
printf(“Area=%d”,A);
getch();
}
7.
Write a program for below Equation
T=(X+Y)/2
X=3
Y=9
#include <conio.h>
main()
{
int X=3,Y=9,T;
clrscr();
T=(X+Y)/2;
printf(“Total=%d”,T);
getch();
}
No comments:
Post a Comment