Sie sind auf Seite 1von 6

EXPERIMENT NUMBER- 1.

STUDENT’S NAME- NAVJYOT SINGH DHALIWAL


STUDENT’S UID- 20BCS3184
CLASS AND GROUP- BCS29/ GRP.A
SEMESTER- 1
DATE- 19/09/2020

TOPIC OF EXPERIMENT-

Learn how to perform input output operations using C

Prerequisites- Basic Mathematics Knowledge

AIM OF THE

EXPERIMENT-

Write a program to input following details of a under-graduate student

i       Name (string)

ii      Age (integer)

iii     Contact number (long long integer)

iv     Percentage in metric class (float / double)

Your program should generate output as follows:

**************STUDENT DATABASE*******************
SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112
Enter name in capital letters: xyz pqr

Enter age                           : 18

Enter contact number        : 9876543210

Enter percentage in metric: 86.84

Thank you. Your data has been saved in our system

************************************************************

FLOWCHART/ ALGORITHM-

1. START
2. declare the values to be assigned like Name, age etc.
3. Define values to the given to the values.
4. Add values
5. Print C
6. STOP

PROGRAM CODE-

#include <stdio.h>

int main()

   char name[20];

   int age;

   long long contact_num;

   float perc;
SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112
   

   printf("Enter name in capital letters: ");

   scanf("%s", name);

   printf("Enter age: ");

   scanf ("%d", &age);

   

   printf("Enter contact number: ");

   scanf("%lld", &contact_num);

   printf("Enter perc in 12th: ");

   scanf("%f", &perc);

   

   printf ("Name= %s", name);

   printf("\nAge= %d", age);

   printf ("\nPhone Number= %lld", contact_num);

   printf("\nPerc =%.2f", perc);

   return 0;

ERRORS ENCOUNTERED DURING PROGRAM’S EXECUTION


(Kindly jot down the compile time errors encountered)-

1. Syntax errors: errors due to the fact that the syntax of the language is not
respected (2 times).
2. Semantic errors: errors due to an improper use of program statements (1time).
SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112
3. Logical errors: errors due to the fact that the specification is not respected (3
times).
4. Compile time errors: syntax errors and static semantic errors indicated by the
compiler (5 times).

PROGRAMS’ EXPLANATION (in brief)-


When we want to store any information (data) on our computer/laptop, we store it in
the computer's memory space. Instead of remembering the complex address of that
memory space where we have stored our data, our operating system provides us with
an option to create folders, name them, so that it becomes easier for us to find it and
access it.

INPUT-OUTPUT USING SCANF AND PRINTF-

SCANF FUNCTION- The scanf function allows you to accept input from standard in,
which for us is generally the keyboard. The scanf function can do a lot of different
things, but can be unreliable because it doesn’t handle human errors very well.

The simplest application of scanf looks like this:

scanf("%d", &b);

PRINTF FUNCTION- printf is a predefined function in "stdio.h" header file, by using


this function, we can print the data or user defined message on console or monitor.

Example of printf function:

Int a=10;

double d=13.4;

printf("%f%d",d,a);

SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112


OUTPUT-

SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112


LEARNING OUTCOMES-
 Learned how to perform input and output operations.
 Learned how to perform input and output using printf and scanf functions.
 The shortest variable name is a letter of the alphabet.
 C lords use the underline, or “underscore,” character in their variable names:
first_name, zip_code, and so on.

EVALUATION COLUMN (To be filled by concerned faculty only)

Sr. No. Parameters Maximum Marks


Marks Obtained
1. Student’s performance while executing the 12
program in Computer Lab
2. Completion of worksheet with learning 10
outcomes and program’s output along with
cleanliness and discipline.
3. Clarification of theoretical concepts 8

4. Total Marks 30

5. Teacher’s Signature (with date)

Das könnte Ihnen auch gefallen