Program to Add Two Numbers in CPP
In this program, the user is asked to enter two numbers which are stored in a and b respectively. The + operator is used for adding these two numbers and…
In this program, the user is asked to enter two numbers which are stored in a and b respectively. The + operator is used for adding these two numbers and…
The break statement is used to terminate the loop. In this program, if the value is equal to 6 then the loop will be terminated and the statement will be…
#include<stdio.h> #include<conio.h> void main() { int i,j,k; clrscr(); for(i=1;i<=5;i++) { for(k=1;k<=5-i;k++) { printf(" "); } for(j=1;j<=i;j++) { printf(" *"); } printf("\n"); } for(i=4;i>=1;i--) { for(k=1;k<=5-i;k++) { printf(" "); } for(j=1;j<=i;j++) …
A simple program to swap two numbers without using the third variable. You have to use some formulas or basic concepts. #include<stdio.h> #include<conio.h> void main() { int a,b; clrscr(); printf("enter…
The program will accept two numbers form the user "a" and "b" for swapping. For this purpose, we have to use a third variable "tmp". #include<stdio.h> #include<conio.h> void main() {…