当前位置:网站首页>C language: on the right shift of matrix
C language: on the right shift of matrix
2022-06-24 00:16:00 【Nianchi ichthyology programming】

#include <stdio.h>
#define N 4
void fun(int (*t)[N] , int m);
int main()
{
int a[][N] = {
21,12,13,24,25,16,47,38,29,11,32,54,42,21,33,10};
int i,j,m;
printf("\n The original matrix is :\n");
for(i = 0 ; i < N ; i++){
for(j = 0 ; j < N ; j++){
printf("%4d",a[i][j]);
}
printf("\n");
}
printf(" Please enter the number of digits to shift right m(m<=%d):",N);
scanf("%d",&m);
fun(a,m);
printf("\n The matrix shifted to the right is :\n");
for(i = 0 ; i < N ; i++){
for(j = 0 ; j < N ; j++){
printf("%4d",a[i][j]);
}
printf("\n");
}
return 0;
}
void fun(int (*t)[N] , int m)
{
int i,j;
for(i = 0 ; i < N ; i++){
for(j = 0 ; j < N ; j++){
t[i][j+m] = t[i][j];
}
for(j = 0 ; j < m ; j++){
t[i][j] = 0;
}
}
}
边栏推荐
- UART protocol timing summary
- 云原生架构(05)-应用架构演进
- 【红绿灯识别】基于matlab GUI红绿灯识别【含Matlab源码 1908期】
- 如何利用数仓创建时序表
- 2021-11-23: Regulations: l[1] corresponds to a, l[2] corresponds to B, l[3] corresponds to C
- Android App bundle exploration, client development interview questions
- Android 3年外包工面试笔记,有机会还是要去大厂学习提升,android开发实习面试题
- Test - use case - detail frenzy
- SQL Server 中 GO 的用法
- == 和 equals 的区别是什么?
猜你喜欢

Keywords such as extern and struct

Android Aidl: cross process call service (Aidl service), kotlininvoke function
![[digital signal] spectrum refinement based on MATLAB analog window function [including Matlab source code 1906]](/img/b3/ad289400e9c74f6f1f533a7d560d5c.jpg)
[digital signal] spectrum refinement based on MATLAB analog window function [including Matlab source code 1906]

Complete open source project poetry bar app

Chaos engineering, learn about it

Leetcode - linked list written test questions

UART protocol timing summary

Tiktok practice ~ password retrieval

跟着CTF-wiki学pwn——ret2text

The first open-source MySQL HTAP database in China will be released soon, and the three highlights will be informed in advance that shiatomics technology will launch heavily
随机推荐
Shuttle global levitation button
C语言:利用自定义函数排序
Usage of go in SQL Server
[traffic light identification] traffic light identification based on Matlab GUI [including Matlab source code 1908]
Complete collection of development environment configuration -- Visual Studio 2022 installation
When the IOT network card device is connected to easycvr, how can I view the streaming IP and streaming time?
Interview notes for Android outsourcing workers for 3 years. I still need to go to a large factory to learn and improve. As an Android programmer
SAVE: 软件分析验证和测试平台
Comment utiliser l'entrepôt de données pour créer une table de synchronisation
Empty encoded password警告原因
kubernetes之常用核心资源对象
Do280openshift access control -- manage projects and accounts
超标量处理器设计 姚永斌 第3章 虚拟存储器 --3.1~3.2 小节摘录
[technical grass planting] the tail of the "double 11" event. Let's talk about how much discount the message push service package is!
Expander+listbox of WPF effect
C语言:递归实现N的阶乘
Fix blog theme php8 compatibility and optimize dark mode
Android - JNI 开发你所需要知道的基础,Android工程师面试题
==What is the difference between and equals?
NLP工程师是干什么的?工作内容是什么?