Q. If sum of two integer is 14 and if one of them is 8 then find other integer. Ans: Well, this is very simple. Simply, one integer is 8 and sum of two integers is 14. So, we need to subtract the number 8 from their sum of 14 to get the second number. So, the second number is: 14 - 8 = 6 C-Program of this task Code---> #include<stdio.h> int main () { int num1 = 8 , num2 , sum = 14 ; num2 = sum - num1 ; printf ( "The second number is: %d" , num2 ); return 0 ; }
In this C -program we will Print a pattern using Asterisks(*). The no. of rows will be taken from the user. In the first Row the no. of spaces will be (n-1) [Here, we considered that, the user entered n no. of rows as input],and then a * . In the 2nd Row the number of Spaces will be decreased and the no. of * will be increased by 1. In that way, the last Row(n th row) have no Spaces and have all(n) * . ----* ---** --*** -**** ***** ► Here, - sign is used as Space for better understanding. input: The no. of Rows. output: The Pattern will be printed on the screen in the given range. CODE----> #include<stdio.h> int main () { int i , j , k , n ; printf ( " Please, Enter the no. of Rows : " ); scanf ( "%d" ,& n ); for ( i = 1 ; i <= n ; i ++) { for ( j = n ; j > i ; j --) { printf ( " " ); } for ( k = 1 ; k <= i ; k ++) { printf ( "*" ); } printf ( "\n&q