saving . . . saved Assignment has been deleted. Assignment has been hidden .
Assignment
Title
Question
Using if statement

#include<stdio.h>
int main ()
{
int a,b;
printf("enter the value of a,b");
scand("%d%d",&a,&b);
if(a>b)
{
printf("a is greater than b\n");
}
if(a<b)
{
printf("a is less  than b\n");
}
return 0;
}
  

The output is as follows
a=45
b=56
a is less than b

C-and-Cpp If-And-Else-If-statement 12-13 min 50-60 sec 11-07-20, 8:26 a.m. Sakshichoudhary

Answers:

Using if statement

#include<iostream>
using namespace std;
int main ()
{
int a,b;
cout<<"enter the value of a,b\n";
cin>>a>>b;
if(a>b)
{
cout<<"a is greater than b\n";
}
if(a<b)
{
cout<<"a is less than b\n";
}
return 0;
}
11-07-20, 8:32 a.m. Sakshichoudhary
The output is 
a= 67
b=45
a is greater than b
11-07-20, 8:34 a.m. Sakshichoudhary

Login to add comment


Using if-else statement

#include<stdio.h>
int main()
int a,b,c;
printed(" enter the value of a,b,c");
scand("%a%b%c",&a,&b,&c);
if(a>b&&b>c)
{
printed("a is greater than b and c\n");
}
if(b>a&&b>c)
{
printed("b is greater than a and c\n");
}
else
{
printed("c is greater than a and b\n");
}
return 0;
}
11-07-20, 8:41 a.m. Sakshichoudhary
The output is as follows
a=56
b=45
c=67
c is greater than a and b
11-07-20, 8:42 a.m. Sakshichoudhary

Login to add comment


Using if else statement

#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"enter the value of a,b,and c";
cin>>a>>b>>c;
if(a>b&&a>c)
{
cout<<"a is greater than b and c\n";
}
if(b>a&&b>c)
{
cout<<"b is greater than a and c\n";
}
else
{
cout<<"c is greater than a and b\n";
}
return 0;
}
11-07-20, 8:51 a.m. Sakshichoudhary
The output is as follows
a=98
b=56
c=45
a is greater than b and c
11-07-20, 8:52 a.m. Sakshichoudhary

Login to add comment


 //assignment 1
 #include<stdio.h>
 Int main()
{
   Print f("welcome to the world of c");
   return 0;
}
//Output: welcome to the world of c
And: cursor will  blink on the link only.
11-07-20, 9:15 a.m. Kadam_vishwas


//program to check a is greater than or less than b//
#include<stdio.h>
void main()
{
int a, b;
printf ("enter the value of a and b") ;
scanf ("%d%d", &a, &b) ;
if(a>b) 
{
printf ("a is greater than b) ;
}
else
{
printf ("a is less than b") ;
}
getch () ;
}
11-07-20, 10:02 a.m. 1921271242003
a=20
b=10
20>10
a us greater than b
11-07-20, 10:03 a.m. 1921271242003

Login to add comment


//program to check which value is greater//
#include <stdio.h>
void main()
{
int a, b, c;
printf ("enter the value of a, b, c) ;
scanf ("%d%d%d", &a, &b, &c) ;
if(a>b&&a>c) 
{
printf ("a is greater") ;
}
else if(b>a&&b>c) 
{
printf ("b is greater ") ;
}
else
{
printf (" c is greater ") ;
}
getch () ;
}
11-07-20, 10:12 a.m. 1921271242003
a=20
b=50
c=40
b>a&b>c
b is greater
11-07-20, 10:14 a.m. 1921271242003
a=20
b=50
c=40
b>a&b>c
b is greater
11-07-20, 10:14 a.m. 1921271242003

Login to add comment


#assignment 1
#include<studio.h>
int main()
{
Printf("welcome to the world of c ");
Return 0;
}
//Output : welcome to the world of c 
Ans : cursor will blink on that line only 
11-07-20, 10:27 a.m. anujagdambe


//assignment 1
#include<stdio.h>
int main()
{
   Print f("welcome to the World of c");
   return 0;
}
//Output : welcome to the World of c
And:cursor will blink on the line only.

11-07-20, 10:36 a.m. sakshiVK


// assignment 1 

// Welcome to the world of C
# include<stdio. h>
int main () 
{
printf ("Welcome to the world of C") ;
return 0;
}
/* output 
Welcome to the world of c
*/

if\n is not included in printf statement cursor will blink on that line only and next statement will be printed on the same line. 
11-07-20, 11:33 a.m. pawarshivani


//program to check a is greater than b or less than b//
#include<stdio.h>
void main()
{
int a, b;
printf ("enter the value of a and b") ;
scanf ("%d%d", &a, &b) ;
if(a>b) 
{
printf ("a is greater than b) ;
}
else
{
printf ("a is less than b") ;
}
getch () ;
}


          Output is as follows
           a=10
           b=7
           a is greater than b
11-07-20, 3:18 p.m. Pranitakotalwar


/program to check which value is greater//
#include <stdio.h>
void main()
{
int a, b, c;
printf ("enter the value of a, b, c) ;
scanf ("%d%d%d", &a, &b, &c) ;
if(a>b&&a>c) 
{
printf ("a is greater") ;
}
else if(b>a&&b>c) 
{
printf ("b is greater ") ;
}
else
{
printf (" c is greater ") ;
}
getch () ;
}


       Output is as follows
        a=60
        b=35
        c=75
        c is greater
11-07-20, 3:25 p.m. Pranitakotalwar


  Assignment 2
  /*my first cpp program
    program to print name and city */
   
    #include<iostream>
     using namespace std;
     int main()
     {
      cout <<"my name is and city\n";
      return 0;
    }
          
   /* output:
       my name is and city  */
    ans:we use here  multiline comment 
11-07-20, 3:30 p.m. 1921271242112


Assignment 1
1. C program 
//My FIRST c program 
# include <studio.h>
int main ()
{
   printf("welcome to the world of c ");
  return 0;
}
2.Cpp program 
// My FIRST cop program 
#include<iostream>
using namespace std;
int main()
{
    cout<<"welcome to the world of c \n";
    return 0;
}



11-07-20, 4:06 p.m. renuka2107


//Assignment1 //
#include <stdio.h>
int main()
{
    printf("welcome to the world of c\n") ;
     return 0;
}
Output
/*welcome to the world to c*/

11-07-20, 4:10 p.m. s19_lokade_prerna@mgmcen.ac.in


  Assignment 3:
  //c program to calculate simple interest on turbo c++
   /* where
      I= interest
      P=principal
      R=rate
      T=time   */

   #include<stdio.h>
    void main()
    {
    float I, P, R, T;
    clrscr();
    printf("enter the values");
    scanf("%f%f%f", &P,&R,&T);
     I=(P*R*T)/100;
    printf("\n I=%f", I);
    getch();
  }
   /* output:
     enter the values 
    P=20
    R=1200
    T=7
 I=1680.000000  */  

11-07-20, 4:21 p.m. 1921271242112


Assignment 2
1.c program

/*program to write my name and city name*/
#include<stdio.h>
int main()
{
printf("my name :desai kirti\n");
printf("city name :Nanded");
return 0;
}

2.cpp program

/*program to write my name and city name*/
#include<iostream>
using namespace std ;
int main()
{
cout<<"my name  :desai kirti \n";
cout<<"city name :Nanded";
return 0;
}
11-07-20, 4:44 p.m. renuka2107


Assignment 3
1.c program
//c program to find simple intrest
#include<stdio.h>
#include<conio.h>
main()
{
float i,p,t,si;
clrscr();
printf("enter a rate of intrest\n");
scanf("%f",&i);
printf("enter a valve of principle\n");
scanf("%f",& p);
printf("enter a time")
scanf("%f",& t);
si=(p*i*t)/100;
printf("simple intrest=%f",si);
getch();
}

2.cpp program
//cpp program to find simple intrest
#include<iostream>
using namespace std ;
int main()
{
float i,p,t,si;
cout<<"enter value of principle";
cin>>p;
cout<<"enter a rate of intrest";
cin>>i;
cout<<"enter a time";
cin>>t;
si=(p*i*t)/100;
cout<<" simple intrest="<<si<<"\n";
}
11-07-20, 5:05 p.m. renuka2107


Assignment 4
1.c program
//c program to write square of number
#include<stdio.h>
#include<conio.h>
int main()
{
int no,sqr;
clrscr();
printf("enter a any number\n");
scanf("%d",& no);
sqr=no*no;
printf("square=%d",sqr);
getch();
}

2.cpp program
//cpp program to write square of number
#include<iostream>
using namespace std;
int main()
{
int no,sqr;
cout<<"enter a number";
cin>>no;
sqr=no*no;
cout<<"square="<<sqr<<";
return 0 ;
}|
11-07-20, 5:22 p.m. renuka2107


 //assignment 1
 #include<stdio.h>
 Int main()
{
   Print f("welcome to the world of c");
   return 0;
}
//Output: welcome to the world of c
And: cursor will  blink on the link only.
11-07-20, 5:36 p.m. anandpande


/*program to write my name and city name*/
#include<iostream>
using namespace std ;
int main()
{
cout<<"my name  :pande anand atul \n";
cout<<"city name :Nanded";
return 0;
}
/*my name is anand
my city name is nanded*/
11-07-20, 5:45 p.m. anandpande


Assignment 5
1.c program
// to find age of employee
#include<stdio.h>
#include<conio.h>
main()
{
int age;
clrscr();
printf("enter age of employee\n");
scanf("%d",&age);
if(age >=20 && age<=60)
{
printf("age of employee is in between 20 to 60");
}
else
{
printf("age is not in between 20 to 60");
}
}

2.cpp program 
// to find age of employee
#include<<iostream>
using namespace std;
int main();
{
int age;
cout<<"enter age of employee");
cin>>age;
if(age>=20&&age<=60)
{
cout<<"age is in between 20 to  60";
}
else
{
cout<<"age is not in between 20 to 60";
}
}
 

11-07-20, 5:46 p.m. renuka2107


Assignment 6
1.c program
//c program to find difference
#include<stdio.h>
void sub ()
{
int a,b;
int c=a-b;
printf("difference of a and b is %d\n",c);
}
void main ()
{
sub();
}

2.cpp program
//cpp program to find difference
#include<iostream>
using namespace std;
int main()
{
int c=a-b;
}
int main()
{
int diff;
diff=sub(a,b);
cout<<"difference is "<<diff<<"\n";
return 0;
}
11-07-20, 5:59 p.m. renuka2107



Assignment 1

#include<studio.h>
int main( )
{
 Printf("welcome to the world of c");
Return 0;
}
 //*Welcome to the world of c*//
 
 
11-07-20, 6:10 p.m. Deshmukmansi


Cpp program
/*Program to write my name and city name*/
#include<upstream>
using name space STD;
Int main ()
  count<<"my name:Mansi Deshmukh \n";
  count<<city: Nanded;
Return 0;
}
/*Output
  my name: Mansi Deshmukh
   City:Nanded */
11-07-20, 6:43 p.m. Deshmukmansi


Cpp program
/*Program to write my name and city name*/
#include<upstream>
using name space STD;
Int main ()
  count<<"my name:Mansi Deshmukh \n";
  count<<city: Nanded;
Return 0;
}
/*Output
  my name: Mansi Deshmukh
   City:Nanded */
11-07-20, 6:43 p.m. Deshmukmansi


Assignment 7
1.   a) c program
//c program to find greater value
#include<stdio.h>
#include<conio.h>
main()
{
int a,b;
clrscr();
printf("enter number a\n");
scanf("%d",&a);
printf("enter number b\n");
scanf("%d",&b);
if(a>b)
printf("a is greater\n");
if(b>a)
printf("b is greater\n");
if(a==b)
printf("a and b are equal");
getch();
}
   b)cpp program
//cpp program to find greater value
#include<iostream>
using namespace std;
'int main()
{
int a,b;
cout<<"enter a value of 'a 'number\n";
cin>>a;
cout<<"enter a value of b \n";
cin>>b;
if(a>b)
cout<<"a is greater";
if(a<b)
cout<<"b is greater";
if(a==b)
cout<<"a and b are same";
}

2. a)c program
//c program to find greater value
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c;
printf("enter value of a \n");
scanf("%d",&a);
printf("enter value of b \n");
scanf("%d",&b);
printf("enter value of c \n");
scanf("%d",&c);
if(a>b&&a>c)
{
printf("a is greater");
}
 else if(b>a&&b>c)
 {
  printf(" b is greater");
 }
 else if (c>a&c>b)
 {
 printf(" c is greater");
 }
}
else
printf("a,b,c are equal");
}

b)cpp program
//cpp program to check greater value
#include<iostream>
using namespace std;
int main()
{
int a,b,c:
cout<<"enter value of a\n";
cin>>a;
cout<<"enter value of b\n";
cin>>b;
cout<<"enter value of c\n";
cin>>c;
if(a>b&&a<c)
 {
   cout<<a<<"is greater";
 }
 else if(b>a&&b>c)
 {
   cout<<"<<b<<" is greater";
 }
 else if(c>a&&c>b)
 {
   cout<<c<<"is greater value";
 } 
 else
   cout<<"a ,b,c are equal";
}

11-07-20, 6:46 p.m. renuka2107


  assignment 1
2.cpp program
  #include< iostream>
  using namespace std;
  int main()
 { 
    cout<<" \n Name: Unmani\n";
    cout<<" \n City:Nanded";
     return 0
}
 Output:
\\* Name: Unmani*\\
\\* City:Nanded*\\

11-07-20, 6:47 p.m. Unmani


//Assignment 6
// c  program to check a is greater than b or less than b

#include<stdio.h>
void main() 
{
int a, b;
clrscr();
printf("enter the value of a and b \n");
scanf("%d%d", &a,&b);
if(a>b) 
{
printf(" a is greater than b\n");
if(b>a) 
{
printf("b is greater than a\n");
return 0 ;

Output as follows 
a=10 
b=5
a is greater than b

11-07-20, 7:05 p.m. Kirtana_maru


// Assignment 6
// Program to check a is greater than b or less than b

#include<stdio.h>
void main ()
{
int a,b;
Clrscr ();
printf ("enter the value of a and b\n");
scanf ("%d%d",&a,&b);
if(a>b)
{
printf ("a is greater than b\n");
}
if(b>a)
{
printf ("b is greater than a\n");
}
return 0;
}
Output of this program will be
a=25
b=20
a is greater than b

11-07-20, 7:23 p.m. s19_more_sneha@mgmcen.ac.in


//Assignment 6
// c program to check which value is greater a, b or c

#include<stdio.h>
void main() 
{
int a, b,c;
clrscr();
printf("enter the value of a, b and c\n");
scanf("%d%d%d", &a, &b,&c);
if(a>b&&a>c)
{
printf("a is greater \n");
else if(b>a&&b>c) 
{
printf("b is greater \n");
else
{
printf(" c is greater \n");
return 0 ;

Output as follows 
a=15
b=18
c=12
b is greater 


11-07-20, 7:29 p.m. Kirtana_maru


//Assignment 6
// c program to check which value is greater a,b or c

# include<stdio.h>
void main ()
{
int a,b,c;
clrscr ();
printf ("enter the value of a, b and c \n");
scanf ("%d%d%d", &a,&b,&c);
if (a>b && a>c)
{
printf ("a is greater\n");
}
else if ( b>a && b>c)
{
printf ("b is greater \n");
}
  else
{
printf ("c is greater\n");
}
return 0;
}
 Output of this program will be
a= 25
b=20
c= 10
a is greater
11-07-20, 7:50 p.m. s19_more_sneha@mgmcen.ac.in


//Assignment 6 
// c++ program to check a is greater than b or less than b

#include<iostream>
using namespace std;
int main() 
{
int a,b;
cout<<"enter the value of a and b \n";
cin>>a>>b;
if(a>b)
{
cout <<"a is greater than b\n";
if(b>a)
{
cout<<"b is greater than a\n";
return 0;

Output as follows 
a=15
b=14
a is greater than b

// c++ program to check which value is greater a, b or c

#include<iostream>
using namespace std;
int main() 
{
int a, b, c;
cout<<"enter the value of a, b and c\n";
cin>>a>>b>>c;
if(a>b&&a>c) 
{
cout<<"a is greater \n";
else if(b>a&&b>c) 
{
cout<<"b is greater \n";
else 
{
cout<<"c is greater \n";
return 0;

Output as follows 
a=10 
b=12
c=16
c is greater 


11-07-20, 7:59 p.m. Kirtana_maru


//welcome to the world of c
#include<studio.h>
int  main ()
{
  printf("welcome to the world of C");
  return 0;
}

11-07-20, 8:40 p.m. 1921271242080


//Assignment 1: program 2: write my name and city  in cpp

#include<upstream.h>
#include<conio.h>
Int main()
{
clrscr();
cout <<"\n name:anuja and city:nanded;
fetch();
}
Output : /* name:anuja and city : nanded*/
11-07-20, 8:43 p.m. anujagdambe


//my name and city name 
#include <iostream>
 using namespace std;
 int main()
{
  cout <<"my name : javeriya \n";
  cout <<" my city : nanded";
  return 0;
}

11-07-20, 8:45 p.m. 1921271242080


//Assignment 6
// C++ program to check a is greater than b or less than b
#include <iostream>
using namespace std ;
Int main ()
{
int a,b;
cout<<"enter the value of a and b\n";
cin>>a>>b;
if(a>b)
{
cout<<"a is greater than b\n";
}
if(b>a)
{
cout<<"b is greater than a\n";
}
return 0;
}
Output as follows
a =20
b=10
 a is greater



//Assignment 6
//C++ program to check which is greater a,b or c

#include <iostream>
using namespace std; 
int main ()
{
int a,b,c;
cout<<"enter the value of a, b and c\n";
cin>>a>>b>>c ;
if (a>b && a>c) 
{
cout <<"a is greater\n";
}
else if (b>a && b>c)
{
cout <<"b is greater\n";
}
else 
{
cout<<" c is greater\n";
}
return 0;

Output as follows
a=10
b=20
c=30
 c is greater


11-07-20, 8:53 p.m. s19_more_sneha@mgmcen.ac.in


Assignment -6
 //C program using if statement to check a is greater than b or less than b//

#include<stdio.h>
void main()
{
int a,b;
printf("enter the value of a and b");
scanf("%d%d",&a,&b);
if(a>b)
{
printf("a is greater than b \n");
}
if(a<b)
{
printf ("a is less than b \n");
}
getch();
}

Output is as follows
a=24
b=34
a is greater than b
11-07-20, 9:42 p.m. 1921271242105


Assignment -6
//C++ program using if statement to check a is greater than b or less than b//

#include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"enter the value of a and b \n";
cin>>a>>b;
if(a>b)
{
cout<<"a is greater than b\n";
}
if(a<b)
{
cout<<"a is less than b\n";
}
return 0;
}

Output is as follows
a=10
b=8
a is greater than b
11-07-20, 9:48 p.m. 1921271242105


//assignment  2    c program calculate S.I.
/* s.i = simple interest
       P=  principal 
       R = rate of interest
       T = time           */
#include <studio.h>
int main ()
{
Int p, r, t;
printf(" Enter three values of  p,r,t\n");
Scanf("%d%d%d",&p,&r,&n);
 S.I = p*r*t/100;
printf(" simple interest =%d",S.I);
return 0;
}

 //c++program 
#include<iostream>
Using namespace std;
int main()
{
int (float)p ,r, t, S.I;
cout<<"Enter the values of p, r, t:";
cin>>p>>r>>t;
S.I= p*r*t/100;
cout<<"simple interest is :"<<S.I;
return 0;
}


11-07-20, 9:52 p.m. Shruti@123


//assignment 3   calculate square
#include <studio.h>
int main()
{
int num, sqr;
Clrscr();
Printf ("Enter a number\n");
Scanf("%d",&num);
Sqr = num*num;
Printf(" square =%d",sqr);
return0;
}                 





2.  Cpp program 
#include<iostream>
Using namespace std;
int main();
{
int  num, sqr;
cout<<"Enter a no.:";
Cin>> no.;
Sqr =num*num;
cout<<"square is :"<<sqr;
return 0;
}

11-07-20, 10:25 p.m. Shruti@123


Assignment -6
//C program using else if statement//

#include<stdio.h>
void main ()
{
int a,b,c;
clrscr();
printf("enter the value of a,b,c");
scanf("%d%d%d", &a,&b,&c);
if(a>b&&a>c)
{
printf ("a is greater\n");
}
else if (b>a&&b>c)
{
printf("b is greater\n");
}
else
{
printf("c is greater\n");
}
return 0;
}

Output of program is as follows
a=44
b=22
c=12
a is greater

Assignment 6
//C++ program using else if//

#include<iostream>
using namespace std;
int main ()
{
int a,b,c;
cout<<" enter the value of a ,b and c\n";
cin>>a>>b>>c;
if(a>b&&a>c)
{
cout<<"a is greater\n";
}
else if (b>a&&b>c)
{
cout<<"b is greater\n";
}
else
{
cout<<"c is greater\n";
}
return 0;
}


Output of program is as follows
a=56
b=45
c=76
c is greater

11-07-20, 10:52 p.m. 1921271242105


#include<iostream.h>
Using namespace std;
{
int main()
Cout<<"my name is navneeta\n";
Cout<<"I live in nanded";
Return 0;
}
/*Output: my name is navneeta
                  I live in nanded*/


11-07-20, 10:52 p.m. Nrk


// assignment 2
#include<iostream>
using namespace std;
int main ()
{
cout<<"name: bhagyashri jadhav \n city: Nanded";
return 0;
}
/* Output : name: bhagyashri Jadhav 
                  City : Nanded
11-07-20, 10:56 p.m. Bhagyajadhav


// assignment 2
#include<iostream>
using namespace std;
int main ()
{
cout<<"name: bhagyashri jadhav & city: Nanded";
return 0;
}
11-07-20, 10:56 p.m. Bhagyajadhav


// assignment 2
#include<iostream>
using namespace std;
int main ()
{
cout<<"name: bhagyashri jadhav & city: Nanded";
return 0;
}
11-07-20, 10:57 p.m. Bhagyajadhav


// assignment 2
#include<iostream>
using namespace std;
int main ()
{
cout<<"name: bhagyashri jadhav & city: Nanded";
return 0;
}
11-07-20, 10:57 p.m. Bhagyajadhav


//find age of employee 
Assignment  4
#include<studio.h>
int main()
{
int age;
Clrscr();
Printf("Enter age of an employee ");
scanf ("%d",&age);
If (age>=20&&age<=60)
{
Printf (" age of employee  is between 20 to 30);
}
else
Printf("age of employee is not in between 20 to 60");
}
return 0;
}




2.cpp
#include<iostream>
Using namespace std;
int main()
{
int age;
cout<<"Enter the age of an employee ";
Cin>>age;
If (age>=20&&age<=60);
cout<<"age is between 20 to 60";
else
cout<<"age is not in between 20 to60";
return 0;
}


11-07-20, 11:04 p.m. Shruti@123


  Assignment 4:
    program to calculate square of number...
 // c program
   #include<stdio.h>
   #include<conio.h>
   void main()
   {
   int sq, a;
   clrscr();
   printf("enter value of a");
   scanf("%d",&a);
   sq=a*a;
   printf("\n sq=%d", sq);
   getch();
  }   
    example: output
        /* enter  value of a
         7
       sq=49  */
   
   
    // cpp
        #include<iostream.h>  
       #include<conio.h>
   void main()
   {
   int sq, a;
   clrscr();
   cout <<"enter value of a";
   cin >>a;
   sq=a*a;
   cout <<"sq="<< sq<<"\n";
   getch();
  }   
    example: output
        /* enter  value of a
         17
       sq=289  */
  
12-07-20, 6:38 p.m. 1921271242112


   //program to print name and city
   #include<iostream>
    using namespace std;
     int main( ) 
    {
       cout<<"name: rukmini and city : nanded";
        return 0;
    }
    
    Output
    /* name: rukmini and city: nanded
             */

   3.program to calculate the simple interest
  
     #include<stdio.h>
      void main( ) 
      {
       float i, p, r, n;
       clrscr( ) ;
       printf("enter the value of p, r, n") ;
       scanf("%f%f%f", &p, &r, &n) ;
    
        i =p*r*n/100;
      
        printf ("\n i =%f" , i) ;
        getch( ) ;
       }
 Output:
       
       /*
       enter the value of p, r, n
        50
        60
        70 
        i= 2100.000000
       */
  
   4.program to calculate the square of a number
  
    #include<stdio.h>
     void main(  ) 
     {
        int num, sqr;
        clrscr( ) ;
        printf("enter the value of num") ;
        scanf("%d", &num) ;
      
         sqr=num*num;
    
         printf ("\n sqr=%d", sqr) ;
         getch( ) ;
        }

 Output:
      /*
      enter the value of number
      3
   
      sqr=9
      */
       


12-07-20, 7:16 p.m. Ruks


   4(b).program to calculate square of number using cpp
   
   #include<iostream>
   using namespace std;
   int main( )
   {
     int num,sqr;
     cout<<"enter the num";
     cin>>num;
     sqr=num*num;
     cout<<"\n sqr"<<sqr;
     
    return 0;
  }
   
    output:
               /*
                    enter the num
                      6
                   sqr=36
               */


12-07-20, 7:46 p.m. Ruks


 //program to print the name and city.    
 #include<iostream>
 using namespace std;
 int main( )
 {
    cout<<"name: vishwas \n and city: nanded";
    return 0;
 }
  Output
  */Name: vishwas and city: nanded
        /*

   3.program to calculate the simple interest                                                             
     #include<studio.h>
      void main( )
     {
        float I, p, r, n;
        clrscr();
        printf("enter the value of p, r, n");
        scanf("%f%f%f", &p,&n,&r);

         i=p*r*n/100;
 
        printf("\n i=%f", i );
        getch();
     }
     output
       /*
       enter the value of p, r, n
       50
       60
       60
       i=2100.000000
        */

   4. Program to calculate the square of the number

     #include<studio.h>
      void main ( )
     {
        int num, sqr;
        clrscr( );
        printf("enter the value of num");
        scanf("%d", &num);

        sqr=num*num;
       
         printf("\n sqr=%d", sqr);
         getch( );
       }
       Output
       
       /*
        enter the value of number
        3
         
        sqr=9
          */
  

12-07-20, 9 p.m. Kadam_vishwas


//program to print name and city
#include<iostream>
 using namespace std;
 int main( )
 {
   cout<<"name:sakshi and city:nanded";
   return 0;
 }
Output
/* name:sakshi and city:nanded
          */




12-07-20, 11:16 p.m. sakshiVK


  4(b). program to calculate square of a number using cpp
  
        #include<iostream>
        using namespace std;
        int main( )
        {
            int num, sqr;
            cout<<"enter the num";
            cin>>num;
            sqr=num*num;
            cout<<"\n sqr"<<sqr;

            return 0;
          }

        Output
                    /*
                      enter the num
                        6 
                      sqr=36
                        */
13-07-20, 8:48 a.m. Kadam_vishwas


3. program to calculate the simple interest 

  #include <stdio.h>
   void main( )
   {
   float i, p, r, n;
   clrscr( );
   printf("enter the value of p, r, n");
   scanf("%f%f%f",&p, &r, &n);
   i=p*r*n/100;
   Printf("\n i=%f" ,i);
   getch( );
   }
Output:

   /*
   enter the value of p, r, n
   40
   50
   60
   i=1200.000000
   */

program to calculate the square of a number 

 #include <stdio.h>
  void main( )
  {
     int num,sqr;
     clrscr( );
     printf("enter the value of num");
     scanf("%d", &num);
     sqr=num*num;
     printf("\n sqr=%d",sqr);
     getch( );
  }

Output:
    /*
    enter the value of number 
    4
     sqr=16
    */
13-07-20, 12:55 p.m. sakshiVK


#include<stdio.h>
void main()
{
  int a,b,c;
  clrscr();
  printf("Enter the values of a,b and c");
  scand("%d%d%d",&a,&b,&c);
  if(a>b&&a>c)
{
  printf("\n a is greater");
}
  else if(b>a&&b>c)
{
  printf("\n b is greater");
}
  else
{
  printf("\n c is greater");
}
  return 0;
}



*****Output*****
a=56
b=78
c=48
b is greater
14-07-20, 6:37 p.m. RPD


#include<iostream>
using namespace std;
int main()
{
  int a,b;
  cout<<"Enter the value of a and b\n";
  cin>>a>>b;
  if(a>b)
{
  cout<<"a is greater than b \n";
}
  if(a<b)
{
  cout<<"a is less than b \n";
}
  return 0;
}


*****Output*****
a=68
b=97
a is less than b
14-07-20, 6:47 p.m. RPD


  //My first program in C++
   #include<iostream>
    using namespace std;
    int main()
    {  
       cout <<"Name:SAILI\n";
       cout <<"City:NANDED";
       return 0;
     }

     Output:
      /* Name:SAILI
          City:NANDED*/



   Assignment 2
    
    Q1.
       //Calculating simple interest
        
       #include<stdio.h>
       int main()
       {    
          int p,r,t;
          int si;
          printf("Enter principal,rate,time\n");
          scanf("%d %d %d",&p,&r,&t);
          si=p*r*t/100;
          printf("Simple Interest=%d",si);
           return 0;
       }


     Output:
    /*Enter principal,rate,time
        20
         5
         10
    Simple Interest=10 */

 
   Q2 
     
       program to calculate square of a number using cpp
  
        #include<iostream>
        using namespace std;
        int main( )
        {
            int num, sqr;
            cout<<"enter the num";
            cin>>num;
            sqr=num*num;
            cout<<"\n sqr"<<sqr;

            return 0;
          }
   
       Output: 
     /* enter the num
          5
         sqr=25 */ 

  
      
      Assignment 3
   
      // Difference of two numbers using global variable
      
       #include<stdio.h >
          int a,b;
           a=20;
           b=10;
          void subtract()
           {        
               int sub;
               sub=a-b;
               printf("Subtraction of a and b is%d\n",sub);
            }
             int main()
            {    
               subtract();
                return 0;
             }
          
Output: 
   /* Subtraction of a and b is 10*/


  



     Assignment 4

   // program to check age of employee
   

   #include<iostream>
   using namespace std;
    int main()
   {
     int age;
       cout<<"Enter the age of an employee ";
       Cin>>age;
       If (age>=20&&age<=60);
       cout<<"age is between 20 to 60";
       else
       cout<<"age is not in between 20 to 60";
       return 0;
    }

    Output : 
   /* Enter the age of an employee 
       10
    age is not in between 20 to 60*/



  Q2
  
    //cpp
    
     #include<stdio.h>
      int main()
      {   
         int a,b,c,d;
         float out;
         printf("give values for a,b,c and d\n");
         scanf("%d%d%d%d,&a,&b,&c,&d);
         out=((float)a/b)+(c/d);
         printf("output=%f",out);
         return 0;  
          
  }


     Output:
   /* give values for a,b,c and d
       10
         5
        4
         2
       output=4.000000*/
   
      

  






















     























15-07-20, 7:52 p.m. Saili_patil



//Assignment 6
// C++ program to check a is greater than b or less than b
#include <iostream>
using namespace std ;
Int main ()
{
int a,b;
cout<<"enter the value of a and b\n";
cin>>a>>b;
if(a>b)
{
cout<<"a is greater than b\n";
}
if(b>a)
{
cout<<"b is greater than a\n";
}
return 0;
}
Output as follows
a =20
b=10
 a is greater



//Assignment 6
//C++ program to check which is greater a,b or c

#include <iostream>
using namespace std; 
int main ()
{
int a,b,c;
cout<<"enter the value of a, b and c\n";
cin>>a>>b>>c ;
if (a>b && a>c) 
{
cout <<"a is greater\n";
}
else if (b>a && b>c)
{
cout <<"b is greater\n";
}
else 
{
cout<<" c is greater\n";
}
return 0;

Output as follows
a=10
b=20
c=30
 c is greater

15-07-20, 9:55 p.m. 1921271242121


//Calculating simple interest
        
       #include<stdio.h>
       int main()
       {    
          int p,r,t;
          int si;
          printf("Enter principal,rate,time\n");
          scanf("%d %d %d",&p,&r,&t);
          si=p*r*t/100;
          printf("Simple Interest=%d",si);
           return 0;
       }


     Output:
    /*Enter principal,rate,time
        20
         5
         10
    Simple Interest=10 */
27-07-20, 7:09 p.m. S19_bansode_pooja@mgmcen.ac.in


//program to calculate square of a number using cpp
  
        #include<iostream>
        using namespace std;
        int main( )
        {
            int num, sqr;
            cout<<"enter the num";
            cin>>num;
            sqr=num*num;
            cout<<"\n sqr"<<sqr;

            return 0;
          }
   
       Output: 
     /* enter the num
          5
         sqr=25 */ 

27-07-20, 7:10 p.m. S19_bansode_pooja@mgmcen.ac.in


//Difference of two numbers using global variable
      
       #include<stdio.h >
          int a,b;
           a=20;
           b=10;
          void subtract()
           {        
               int sub;
               sub=a-b;
               printf("Subtraction of a and b is%d\n",sub);
            }
             int main()
            {    
               subtract();
                return 0;
             }
          
Output: 
   /* Subtraction of a and b is 10*/

27-07-20, 7:11 p.m. S19_bansode_pooja@mgmcen.ac.in


//program to check age of employee
   

   #include<iostream>
   using namespace std;
    int main()
   {
     int age;
       cout<<"Enter the age of an employee ";
       Cin>>age;
       If (age>=20&&age<=60);
       cout<<"age is between 20 to 60";
       else
       cout<<"age is not in between 20 to 60";
       return 0;
    }

    Output : 
   /* Enter the age of an employee 
       10
    age is not in between 20 to 60*/

27-07-20, 7:12 p.m. S19_bansode_pooja@mgmcen.ac.in


//cpp
#include<stdio.h>
      int main()
      {   
         int a,b,c,d;
         float out;
         printf("give values for a,b,c and d\n");
         scanf("%d%d%d%d,&a,&b,&c,&d);
         out=((float)a/b)+(c/d);
         printf("output=%f",out);
         return 0;  
          
  }


     Output:
   /* give values for a,b,c and d
       10
         5
        4
         2
       output=4.000000*/
   
      

27-07-20, 7:14 p.m. S19_bansode_pooja@mgmcen.ac.in


<span style="background-color: rgb(250, 250, 250);">//Using if statement</span>

#include<stdio.h>
int main ()
{
int a,b;
printf("enter the value of a,b");
scand("%d%d",&a,&b);
if(a>b)
{
printf("a is greater than b\n");
}
if(a<b)
{
printf("a is less  than b\n");
}
return 0;
}
  

The output is as follows
a=45
b=56
a is less than b

27-07-20, 7:16 p.m. S19_bansode_pooja@mgmcen.ac.in


Using if statement

#include<iostream>
using namespace std;
int main ()
{
int a,b;
cout<<"enter the value of a,b\n";
cin>>a>>b;
if(a>b)
{
cout<<"a is greater than b\n";
}
if(a<b)
{
cout<<"a is less than b\n";
}
return 0;
The output is 
a= 67
b=45
a is greater than b
27-07-20, 7:17 p.m. S19_bansode_pooja@mgmcen.ac.in


<font size="4">program in c to check a is greater than b or less than b:</font>

#include <stdio.h>

int main() 
{
    int a,b;
    printf("Enter the value of a and b");
    scanf("%d %d",&a,&b);
    if (a>b)
    printf("a is greater than b");
    else
    printf("a is less than b");
    return 0;
}

Output :

Enter the value of a and b
44
65
a is less than b


program in cpp to check a is greater than b or less than b:


#include <iostream>
using namespace std;
int main() 
{
    int a,b;
    cout<<"Enter the value of a and b";
    cin>>a>>b;
    if (a>b)
    cout<<"a is greater than b";
    else
    cout<<"a is less than b";
    return 0;
}

Output:

Enter the value of a and b
44
65
a is less than b

program in c to check which value is greater a,b or c:

#include <stdio.h>

int main() 
{
    int a,b,c;
    printf("Enter the value of a,b and c");
    scanf("%d %d %d",&a,&b,&c);
    if ((a>b)&&(a>c))
    printf("a is greatest among three values");
    else if (b>c)
    printf("b is greatest among three values");
    else
    printf("c is greatest among three values");
    return 0;
}

output:

Enter the value of a,b and c
4
3
7
c is greatest among three values


program in cpp to check which value is greater a,b or c:

#include <iostream>
using namespace std;
int main() 
{
    int a,b,c;
    cout<<"Enter the value of a,b and c";
    cin>>a>>b>>c;
    if ((a>b)&&(a>c))
    cout<<"a is greatest among three values";
    else if (b>c)
    cout<<"b is greatest among three values";
    else
    cout<<"c is greatest among three values";
    return 0;
}

Output:

Enter the value of a,b and c
4
3
7
c is greatest among three values






<font size="4">
</font>



23-01-24, 4:42 p.m. Vaishnavi2885


Log-in to answer to this question.