Programming Language
Programming Language
Programming Fundamental
Assignment No 01 Marks 20
Q1: Write a program which asks the user to enter Hours, minutes and
seconds and then calculate
Q2: Write a program which accepts a character and display its ASCII
value. (5)
Q3: Write a program to swap the values of two variables without using
third variable. (10)
Question 1: Write a program which asks the
user to enter Hours, minutes and seconds and then
calculate the total time in seconds and display it
Answer:
PROGRAM
#include<iostream.h>
#include<conio.h>
int main()
int x , y, z, total;
getch();
}
Output:
QUESTION 2:Which program accepts a character
and display its ASCII value?
Answer:
Program:
#include<iostream.h>
#include<stdlib.h>
int main()
char ascii;
int numeric;
cout << "Its ascii value is: " << (int) ascii << endl;
cout << "The ascii value of " << numeric << " is " << (char) numeric;
system(PAUSE);
}
Output:
Question 3: Write a program to swap the values of two
variables without using third variable
Answer:
Program:
#include <iostream.h>
#include <stdlib.h>
int main()
{
int x, y, temp;
x = 10;
y = 20;
temp = x;
x = y;
y = temp;
system("PAUSE");
}
Output: