Programming Fundamentals (Cs-116T) Assignment 1
Programming Fundamentals (Cs-116T) Assignment 1
FUNDAMENTALS (CS-116T)
Assignment 1
• NAME: SHAIKH NEHAL AHMED
• ROLL NO.: 028
• Batch: 2020
• Department: IT
Question 1
What will be output of following codes, first solve it on page, and then verify it from visual studio compiler.
Question a)
#include<iostream>
int main( )
{
int a = 300, b, c ;
if ( a >= 400 )
b = 300 ;
c = 200 ;
return 0;
}
OUTPUT:
b= c=200
Question b)
#include<iostream>
using namespace std;
int main( ){
int x = 3, y = 5 ;
if ( x == 3 )
cout<<x<<" ";
else ;
cout<<y;
return 0;
}
• OUTPUT:
•3
Question c)
#include<iostream>
using namespace std;
int main( )
{
int x = 3, y, z ;
y = x = 10 ;
z = x < 10 ;
return 0;
}
• OUTPUT:
INPUT:
#include <iostream>
using namespace std;
int main()
{
float cost, sell, loss, profit;
INPUT:
#include <iostream>
using namespace std;
int main()
{
int X, Y; • OUTPUT:
cout << "please enter X value: ";
cin >> X;
cout << "please enter Y value: ";
cin >> Y;
if (X % Y == 0)
cout << "Y is a multiple of X";
else
cout << "Y is not a multiple of X";
return 0;
}
3. If the three sides of a triangle are entered through the keyboard, write a program to check whether the triangle is valid or
not. The triangle is valid if the sum of two sides is greater than the largest of the three sides.
INPUT:
#include <iostream>
#include<conio.h>
using namespace std;
int main()
• OUTPUT:
{
int a, b, c;
return 0;
}
4. Write a program which takes as input a floating number and prints its ceiling Integer.
INPUT:
#include <iostream> • OUTPUT:
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
float number;
Input:
#include <iostream>
#include<conio.h>
#include<math.h> • OUTPUT:
using namespace std;
int main()
{
float number;