How to write programs in C with Solution
Programs to print patterns
Write a program to print the following pattern.
*
**
***
****
*****
******
*******
********
*********
**********
Code:
#include<stdio.h> int main() { int i,j; for(i=1; i<=10; i++) { for(j=1; j<=i; j++) { printf("*"); } printf("\n"); } getch(); }
Write a program to print the following pattern.
**********
*********
********
*******
******
*****
****
***
**
*
Code:
#include<stdio.h> int main() { int i,j; for(i=10; i>=1; i--) { for(j=1; j<=i; j++) { printf("*"); } printf("\n"); } getch(); }
Write a program to print the table of a number using for loop.
Code:
#include<stdio.h> int main() { int i,num; printf("Enter an integer for a table: "); scanf("%d",&num); for(i=1; i<=10; i++) { printf("%d * %d = %d",num,i,num*i); printf("\n"); } getch(); }
Output:
Enter an integer for a table: 5 5 * 1 = 5 5 * 2 = 10 5 * 3 = 15 5 * 4 = 20 5 * 5 = 25 5 * 6 = 30 5 * 7 = 35 5 * 8 = 40 5 * 9 = 45 5 * 10 = 50
Recommended

How To Get Day From Date in SQL Server
In this article, "How to get day from date in SQL Server" we will learn how we can get day from date provided as input parameter from string and table column.

Advanced SQL Queries For Practice With Solution
In "Advanced SQL Queries For Practice With Solution", we learn queries with correlated, non-correlated, Joins, stored procedures, functions, etc.

SQL Queries For Practice With Solution
In this article "SQL Queries For Practice With Solution", we will learn how to write SQL Queries from basic level to advance level with practical examples.

How To Use ROW_NUMBER Function in SQL
In this article How To Use ROW_NUMBER Function in SQL, we will learn how to generate row numbers for every new record in the select list using ROW_NUMBER().

Date and Time Functions in SQL Server
Date and Time Functions in SQL Server we will look current_timestamp, dateadd(), datediff(), datename(), datepart(), day(), getdate(), month(), year() etc.

How To Find Nth Highest Salary in SQL Server
In this article, we will learn how to find the Nth highest salary of an employee with some practical examples in SQL Server.

STORED PROCEDURE in SQL Server
In this article, Stored Procedure in SQL Server we will learn how to create a stored procedure without parameters and with single or multiple parameters.

How To Join Tables Data in SQL Server
In this article, Joins(Inner, Outer, Cross) in SQL Server we will learn what are Joins and types of joins like inner, outer, and cross join with examples.

How to Backup Table Using SELECT INTO Statement
In this article, How to Backup Table Using SELECT INTO Statement we learn how to backup SQL tables with or without data using T-SQL or Graphical User Interface.